Syntax
enum color {white = 10, green = 14, red, blue, black = 7, yellow}
| index | name | value |
|---|---|---|
| 0 | white | 10 |
| 1 | green | 14 |
| 2 | red | 15 |
| 3 | blue | 16 |
| 4 | black | 7 |
| 5 | yellow | 8 |
enum color my_color; - declare variable of type enum color | ||
my_color = red - assign red |
Compiler inserts values instead names