C enums

 
#include <stdio .h>
 
enum months {
JAN = 1, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC };
 
const char *monthName[] = { "", "January", "February", "March",   
"April", "May", "June", "July", "August", "September", "October",
"November", "December" };
 
int main() {
enum months month;  
 
for (month = JAN; month < = DEC; month++) {
puts(monthName[month]);
}
return 0;
}

Leave a Reply