A question about typedef!

mbrennan at swift.cs.tcd.ie mbrennan at swift.cs.tcd.ie
Fri Nov 23 00:37:16 AEST 1990


In article <1990Nov20.153907.12373 at mathrt0.math.chalmers.se>, d0thomas at dtek.chalmers.se (Thomas Lundqvist) writes:
> Hello! Could someone please tell me the difference between:
> 
> (1)  struct TEST { int a; };
> 
> (2)  typedef struct { int a; } TEST

With case (1) you would delcare a variable:    struct TEST foo ;
but with case (2) you would write              TEST foo ;

In case (1) the words "struct TEST" together are a type, in the same way
as int, char long etc are types, but with case (2) the word "TEST" on it's
own is a type.
-- 
 ,   ,  ,      ,              ,       ,          ,          , ,      ,
Micheal O Braonain     Roinn Riomheolaiochta, Colaiste Na Trinoide, BAC 2.
Email                  mbrennan at cs.tcd.ie



More information about the Comp.lang.c mailing list