An enumeration, introduced by the keyword enum, is a set of integer enumeration constants represented by identifiers.
Values in an enum start with 0, unless specified otherwise, and are incremented by 1.
Example :
1 2 3 4 5 6 7 8 9 10 | #include <stdio.h> #include <stdlib.h> enum week{ sunday, monday, tuesday=7, wednesday=6, thursday, friday , saturday}; int main(){ enum week today; today=thursday; printf("%d day\n",today); return 0; } |
Output :
7 day
0 Comment to "Enumerations"
Post a Comment