Actions

EmSys

C - Arrays of Structures3

From EdWiki

Arrays of Structures ...

Dynamic Allocation

struct Month* pmtab;
pmtab = (struct Month*)malloc(sizeof(struct Month)*NMONTHS);

If p is a pointer to a structure, arithmetic on p takes into account the size of the structure, so p++ incrments p by the correct amount to get the next element of the array of structures.