This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

printf statement with enum data type

I run into a problem using enum datatype
with printf statement. The folloing code
works with Viusal C but does not work
with KEIL compiler --- printf statement
prints out the wrong value. Could somebody
in this forum tell me what I did wrong here? --- here is the test code

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

void main(void)
 {
   birthday = NOV;
   printf("\n\r\ My birthday = %d",  birthday);

 }


It should print out 11 but instead it prints out 3030 on my machine !!!

0