C enums tutorial example explained
#C #enums #enumerations
enum Day{Sun = 1, Mon = 2, Tue = 3, Wed = 4, Thu = 5, Fri = 6, Sat = 7};
int main()
{
// enum = a user defined type of named integer identifiers
// helps to make a program more readable
enum Day today;
today = Sun;
if(today == Sun || today == Sat)
{
printf("\nIt's the weekend! Party time!");
}
else
{
printf("\nI have to work today :(");
}
return 0;
}
#C #enums #enumerations
enum Day{Sun = 1, Mon = 2, Tue = 3, Wed = 4, Thu = 5, Fri = 6, Sat = 7};
int main()
{
// enum = a user defined type of named integer identifiers
// helps to make a program more readable
enum Day today;
today = Sun;
if(today == Sun || today == Sat)
{
printf("\nIt's the weekend! Party time!");
}
else
{
printf("\nI have to work today :(");
}
return 0;
}
- Category
- Bro Code
- Tags
- enumeration, enumeration in c, enumeration in c programming

Be the first to comment