Home Segments Index Top Previous Next

434: Sidetrip

A more general form of the enumeration declaration allows you to create enumeration data types. These new data types allow you, in turn, to create enumeration variables.

The following declaration, for example, makes industry_code an enumeration data type and assigns values to six enumeration constants:

enum industry_code 
  {food, trucking, computers, metals, health, airline}; 

Subsequently, you can specify that particular variables are industry_code variables by using the two symbols enum industry_code as a data type. The following, for example, makes c a industry_code variable:

enum industry_code c;