In the above example,we declared “day” as the variable and the value of “Thurs” is allocated to day,which is 3.
So,as a result 3 is printed.
Example 1:
Example 2:
Note:
Two enum names can have the same values.
If we do not explicitly assign values to enum names,the compiler by default assigns values starting from 0.
We can assign values to some name in any order.All unsigned names get value as value of previous name plus one.
Example:
Output:
1 2 5 6 10 11 12