I am not familiar with c, and was looking at some c code and came across this struct def:
typedef struct _Info
{
.....
.....
some declarations
......
} Info;
Is this a structure named Info of type _Info or is it the otherway around?
thanks
Mike,
The trailing name is the one to use. A C compiler reads the structure in a linear manner from "{" to "}" then reads the name after it.
thanks for the quick reply Hutch
Not exactly
This is the lazy version of 2 statements: one for the typedef and another one for the structure.
Hence in this "single" compound statement the structure _Info is defined in the inner part of the statement and then a new type is created in the outer part of the statement. A type named "Info" that is typedf'ed as being the same as "struct _Info".
The struct _Info also does exist for the compiler.
This typedef is usually made because people do not like to type "struct _Info" all over the place.
But Hutch is right in the short answer: the last name is the one that is usually used.