TechnologY

Play With Enum

#include <stdio.h>

enum months 
   JAN = 1, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC };

int main()

   enum months month; 

   const char *monthName[] “”“January”“February”“March”
      “April”“May”“June”“July”“August”“September”“October”,
      “November”“December” };
   
   for month = JAN; month <= DEC; month++ ) {
      printf“%2d%11s\n”, month, monthNamemonth ] );
   

   return 0;
}

 

1    January
 2   February
 3      March
 4      April
 5        May
 6       June
 7       July
 8     August
 9  September
10    October
11   November
12   December
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s