Actions

EmSys

C - Structures4

From EdWiki

Structures ...

If pp points to a POINT structure, *pp is the structure, and (*pp).x and (*pp).y are the members.

e.g,

struct POINT org, *pp;
pp = &org;
printf( “Origin is (%d, %d)\n”, (*pp).x, (*pp).y );

Pointers to structures are so frequently used that an alternative notation is provided as a shorthand.

pp->member_of_structure
printf( “Origin is (%d, %d)\n”, pp->x,  pp->y );