// Illustrates syntax for a array of pointers // to struct variables. #include #include using namespace std; const int size = 20; typedef struct { int field1; float field2; char field3[size]; } rectype; typedef rectype *recPtr; void main() { rectype rec1 = {1, 3.1415f, "pi"}; recPtr rayPtrs[size]; rayPtrs[size-1] = &rec1; // Here, the array index is applied before dereferencing: cout << (*rayPtrs[size-1]).field1 << endl << (*rayPtrs[size-1]).field2 << endl << (*rayPtrs[size-1]).field3 << endl << endl; }