Enums In C
What are enums?
a user defined type of named integer identifiers helps to make a program more readable
#include <stdio.h>
enum Day{Sun = 1, Mon = 2, Tue = 3, Wed = 4, Thu = 5, Fri = 6, Sat = 7}
int main(){
enum Day today = sun;
printf("%d\n", today);
if (today == Sun || today == Sat)
{
printf("It's the weekend\n");
}
else{
printf("I have to work\n");
}
return 0;
}