|
|
Enumerations |
|
Has the syntax :
enum <name> { <name1>, <name2>, ... }
The first name will be given the value 0, the second will be given the value 1, and so on.
Explicit values can be given to the names by specifying the value.
Examples
enum boolean { NO, YES };
Defines two values, NO = 0 and YES = 1
enum months { JAN = 1, FEB, MAR }
Defines three values, JAN = 1, FEB = 2, MAR = 3