Code:
struct Alias { char *s_a_name; char **s_aliases; short *s_dumr; int s_get_sum; }
defines a new data type that has the name Alias and is a struct . The original C language design is a little clumsy here, because to use them, structure type names always have a prefix with the struct keyword when they are used.
This means the code:
struct Alias { char *s_a_name; char **s_aliases; short *s_dumr; int s_get_sum; } Get_noAllyp, *no_getOf;
declares a Get_noAllyp variable of type struct Alias and a variable no_getOf type pointer to struct Alias .
By Get_noAllyp typedef keyword in front, the identifiers Get_noAllyp and no_getOf become types (and not variables).
Get_noAllyp same as struct Alias and no_getOf same as struct Alias * (that is, a pointer to struct Alias`).
Now you can write:
struct Alias x; struct Alias *y;
or
Get_noAllyp x; no_getOf y;
declare x as a variable of type struct Alias and y as a variable of type pointer to a struct Alias .
source share