Mail Archives: djgpp/1997/10/13/09:30:00
On Tue, 14 Oct 1997, Jamie Love wrote:
> during my forays into the allegro code, i noticed that structs are set up
> like:
>
> typedef struct X
> {
> .....
> } X;
> ...
> X x;
>
> Now, when i was programming in borlands compiler, i just went:
>
> struct X
> {
> .....
> };
> ...
> X x;
>
> So, what is the difference??
The last line is not a legal C syntax. You need to say "struct X x;"
instead. When you use typedef, you tell the compiler that type X is a
kind of alias to "struct X".
Please note that this discussion is a bit off-topic here; if you want to
discuss it further, please post to comp.lang.c.
- Raw text -