View Single Post
  #3   Spotlight this post!  
Unread 23-10-2005, 17:47
Mike's Avatar
Mike Mike is offline
has common ground with Matt Krass
AKA: Mike Sorrenti
FRC #0237 (Sie-H2O-Bots (See-Hoe-Bots) [T.R.I.B.E.])
Team Role: Programmer
 
Join Date: Dec 2004
Rookie Year: 2004
Location: Watertown, CT
Posts: 1,003
Mike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond repute
Re: Typedef Struct as function input

Quote:
Originally Posted by sciguy125
Shouldn't a pointer work?
I've never used pointers before really, so could you show an example?

The way I think it's supposed to work (but isn't) would be to have something like...
Code:
void Function(*data);

void Function(*data)
{
printf("%s \n", data.something);
}

typedef struct{
int blah;
} typedef_example;

typedef_example data;
data.blah = 1;

Function(&data);
But it's getting a syntax error on the function prototype.
__________________
http://www.mikesorrenti.com/