If you like, you can specify the value of particular enumeration constants
by including integers in the enumeration declaration. In the following
example, the value of the additional clothing
constant is 10
,
and, because the value of each succeeding constant lacking an expressed
value is 1 more than that of the previous constant, the value of
travel
is 11
.
enum {food, trucking, computers, metals, health, airline, clothing = 10, travel};
Note the contrast with the following, alternative declaration, for which
the value assigned to clothing
is 6
and the value assigned to
travel
is 7
:
enum {food, trucking, computers, metals, health, airline, clothing, travel};