An enum
is a user-defined data type in C that consists of named integer constants.
#includeenum Day {Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday}; int main() { enum Day today = Wednesday; printf("Today is day number %d\n", today); // Output: 3 return 0; }
This program defines an enum Day
and assigns the value Wednesday
to the variable today
. The program then prints the integer value of today
.