NO

Author Topic: enumerated type  (Read 2712 times)

buckbuilt03

  • Guest
enumerated type
« on: August 10, 2011, 02:14:31 AM »
Can actual numbers be used as enumerated constants?   Example:  typedef enum   {1, 3, 5, 6, 7}  numbers_t;
  I know that each position represents an integer value beginning with zero but, can numbers be valid as constants??  Thanks for any help.

CommonTater

  • Guest
Re: enumerated type
« Reply #1 on: August 10, 2011, 02:29:00 AM »
I may be corrected on this one but I believe the constants in an enum follow the C rules for variable names, in that they cannot begin with a number.


buckbuilt03

  • Guest
Re: enumerated type
« Reply #2 on: August 10, 2011, 03:00:34 AM »
yea, the constants cannot be numeric, character or string literals.....Thanks tater!

CommonTater

  • Guest
Re: enumerated type
« Reply #3 on: August 10, 2011, 07:14:04 AM »
No worries...