C-programming - Example for enum operator, What is enum data type

Example for enum operator

What is enum datatype?
Enumeration is a data type. We can create our own data type and define values that the variable can take. This can help in making program more readable. enum definition is similar to that of a structure.

In the below program we have created a enumerated data type named days and variables Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday have been defined to it.

The values are store into the variable Days as Sunday as 0, Monday as 1 and Saturday as 6. When the user user gives input as 0 or 6, the program will print the days as holiday, here by using the logical operator we have made a condition to print the days as holiday.
#include <stdio.h>
int main()
enum Days {Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday};
Days Dayy;
int j = 0;
printf(<q>Please Enter the day(0 to 6)\n</q>);
Dayy = Days(j);
if(Dayy == Sunday || Dayy == Saturday)
printf(<q>At work\n</q>);
return 0;

 Please enter the day of the week (0 to 6): 0

The topic on C-programming - Example for enum operator is posted by - Maha

Hope you have enjoyed, C-programming - Example for enum operatorThanks for your time

Tech Bluff