If you like, you can provide values for particular enumeration constants by
including integers in the enumeration statement. In the following example,
the value of the additional hop_code
constant is 5
, and
because the value of each succeeding constant lacking an expressed value is
1 more than that of the previous constant, the value of ref_code
is
6
:
enum {eng_code, box_code, tnk_code, cab_code, hop_code = 5, ref_code};
Note the contrast with the following, alternative declaration,
for which the value assigned to hop_code
is 4
and
the value assigned to ref_code
is 5
:
enum {eng_code, box_code, tnk_code, cab_code, hop_code, ref_code};