Structures can be initialized, either by explicitly assigning values
to each
member or in the following way:
#include <iostream.h>
/* An example of member arrays and
arrays of structures */
enum gender { FEMALE, MALE };
typedef gender Gender;
struct person{
char last_name[20];
char first_name[20];
Gender sex;
int age;
};
typedef person Person;
Person staff[20];
/* staff - denotes the complete array
** staff[i] - denotes a variable of type Person
** staff[i].last_name - denotes an array of characters which
may be assigned , compared or output using the
usual string operators
** staff[i].last_name[j] - denotes a single character value */
Person staff[] = /* initialization of staff array */
{{ "Aikman", "Troy", MALE, 26},
{ "Irwin", "Michael", MALE, 25},
{ "Smith", "Emmitt", MALE, 26}};