1// An example program to demonstrate working
2// of enum in C
3#include<stdio.h>
4
5enum week{Mon, Tue, Wed, Thur, Fri, Sat, Sun};
6
7int main()
8{
9 enum week day;
10 day = Wed;
11 printf("%d",day);
12 return 0;
13}
14// OUTPUT
152
1//enum <name of enumeration> { <possible choices separated by commas> }
2enum type_of_fuel{ Gasolina, Gasoleo, Hibrido, Eletrico};
1// Changing default values of enum constants
2enum suit {
3 club = 0,
4 diamonds = 10,
5 hearts = 20,
6 spades = 3,
7};
1#include<stdio.h>
2
3enum week{Mon, Tue, Wed, Thur, Fri, Sat, Sun};
4
5int main()
6{
7 enum week day;
8 day = Wed;
9 printf("%d",day);
10 return 0;
11}
12// OUTPUT
132