I've recently started to study about structs and pointers but there is something I didn't fully understand about the design of a struct
. I understand the declaration of the struct
i.e typedef struct Alias
and its content but I don't understand Get_noAllyp
and *no_getOf
at the end of the statement. What are they? I couldn't really find a good source either.
typedef struct Alias {
char *s_a_name;
char **s_aliases;
short *s_dumr;
int s_get_sum;
}Get_noAllyp, *no_getOf; /*Here, I don't understand this one.
Where did these two variables come from?
And one of them is a pointer.*/
It defines multiple typedef
s, i.e multilple "names" for the same thing, while the second is a pointer to it.
The first one Get_noAllyp
is the name given for the struct, while no_getOf
represents a pointer to it.
I.e, writing no_getOf
is completely the same as writing Get_noAllyp *
in function signatures or variable declarations.