Enums
Enumerated types (enum s) ...
- define a new data type by listing its values (names)
- specify an ordering on the values
- associate the values (names) with
int s
Example:
enum Mood { depressed, sad, well, happy };
|
is equivalent to the definitions:
#define depressed 0
#define sad 1
#define well 2
#define happy 3
|
and a new type enum Mood which is effectively unsigned int .
|