Declaration
enum DaysOfWeek
{
Monday,
Tuesday,
Wednesday,
Thursday,
Friday,
Saturday,
Sunday
}Each enum value has an integer associated with it, starting at 0 by default.
Declaration below is identical to the above.
enum DaysOfWeek
{
Monday = 0,
Tuesday = 1,
Wednesday = 2,
Thursday = 3,
Friday = 4,
Saturday = 5,
Sunday = 6
}Starting indexed can be changed as below.
Following values will have indices incremented by 1.
i.e., Tuesday's index will be 2, Wednesday's will be 3, and so on.
Last updated