
Pointers 127
20 return 0;
21}
The following C language statements declare an array of pointers to struct Com-
plexNum, then assign the address of structure variable var to the third element of the
pointer array cmplxPtrArray.
struct ComplexNum
*
cmplxPtrArray[150];
cmplxPtrArray[2] = &var;
An alternate syntax can be used for dereferencing a pointer to a struct. The special
characters -> after the name of the pointer variable can access any of the fields in
the struct. This is shown in the following two statements:
xr = cmplxPtr->realpart;
xi = cmplxPtr->imagpart;
One convenient feature of the C type syntax is that it avoids the circular definition
problems