enum day {SUN,MON, TUE, WED, THU, FRI, SAT};
enum day rday;
First Line Creates “User Defined Data Type” called day and has 7 values as given in the pair of braces.
In the second line “rday” variable is declared of type “day” which can be initialized with any “data value amongst 7 values”.
Default Numeric value assigned to first enum value is “0”. So SUN is given value “0”.
MON is given value “1”.
TUE is given value “2”.
WED is given value “3”.
THU is given value “4”.
FRI is given value “5”.
SAT is given value “6”.
Now say rday=MON;
then printf("%d", rday); would be 1.
Enumerated values are converted into integer values internally by the compiler and provide the flexibility and readability to the code. The only difference would be the size (size of the enum is compiler dependent and not necessary be equal to int).