Typedef is very useful for portable names, tag names (typedef struct foo Foo;
) and
keeping complicated (function) declarations readable (typedef int
(*cmpfunc
Without typedef, you have to use the keyword struct everytime if you use a struct in declarations. With typedef, you can omit this.
struct Person
{
char * name;
};
struct Person p; /* need this here*/
typedef struct _Person
{
char * name;
} Person;
Person p; /* with typedef I can omit struct keyword here */