This article is a Enumeration example.
The enumerated data type (enum) is used to declare named integer constants.
The general form is: enum tag_name {enumeration_list}variable_list
tag_name and variable_list are optional.
By default , the integer value assosiated with the leftmost name of the list is 0 and the value of each name in the rest of the list increases by one from the left to right.
We can also assign integer values to the enum names as we prefer.
You can also use #define to do the same job. #define is a general form used for macros.
The C code The result |