I know that if I defined an enum weekday like this:
enum weekday {
MON,
TUE,
WED,
THU,
FRI,
};
Then, MON would internally e
Just to complement on other answers, I'll give you a practical example of how using the same value for different enumerations on a given enum
is widely useful:
enum slots_t {
SLOT_FIRST = 0,
SLOT_LEFTARM = SLOT_FIRST,
SLOT_RIGHTARM = 1,
SLOT_TORSO = 2,
SLOT_LEFTLEG = 3,
SLOT_RIGHTLEG = 4,
SLOT_LAST = SLOT_RIGHTLEG
};
Then you can do in your code:
for (int i = SLOT_FIRST; i <= SLOT_LAST; ++i) { }