Message-Id: Date: Sat, 25 Oct 1997 23:03:47 +0200 To: joshuahab AT aol DOT com, djgpp AT delorie DOT com References: <19971023043001 DOT AAA27550 AT ladder02 DOT news DOT aol DOT com> Subject: Re: structures and structure pointers MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT From: Georg DOT Kolling AT t-online DOT de (Georg Kolling) Precedence: bulk Joshua Hab schrieb: > I have a couple of questions regarding structures and structure pointers... > > First, what's the difference between a regular structure and a typedef > structure? For example, what would be the difference between these two: > > struct sprite > { > int x, y, color; > } /* here's a semicolon missing... */ ; > > typedef struct SPRITE > { > int x, y, color; > } /* here again */ ; This one does exactly nothing... you should use: typedef , the new name's missing here typedef gives a data type a new name, for example: 'typedef unsigned int uint;' makes 'uint' equvalent to 'unsigned int' 'typedef struct SPRITE { int x, y, color } NewNameForStructSPRITE;' makes 'NewNameForStructSPRITE' equivalent to 'struct SPRITE' > > Secondly, how exactly does the -> operator work? How is it different from the > '.' operator? I've know it has something to do with structure pointers, but > I'm still baffled, I'd really appreciate some direction. :-) Thanks in > advance. example: struct sprite Sprite; struct sprite *pointer_to_Sprite = &Sprite; Sprite.x = 1; pointer_to_Sprite->y = 1;