Pelles C forum

C language => Beginner questions => Topic started by: buckbuilt03 on August 10, 2011, 02:14:31 AM

Title: enumerated type
Post by: buckbuilt03 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.
Title: Re: enumerated type
Post by: CommonTater 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.

Title: Re: enumerated type
Post by: buckbuilt03 on August 10, 2011, 03:00:34 AM
yea, the constants cannot be numeric, character or string literals.....Thanks tater!
Title: Re: enumerated type
Post by: CommonTater on August 10, 2011, 07:14:04 AM
No worries...