Path: utzoo!mnetor!motto!dave From: dave@motto.UUCP (David Brown) Newsgroups: comp.lang.c Subject: How many values in an enum (Was: Enumerated types... what's the point?) Message-ID: <96@motto.UUCP> Date: 26 Mar 90 18:14:40 GMT References: <1990Mar22.053148.10351@ncsuvx.ncsu.edu> <1990Mar22.164943.10459@utzoo.uucp> <1425@polari.UUCP> Reply-To: dave@motto.UUCP (David Brown) Lines: 19 In article <1425@polari.UUCP> blm@6sceng.UUCP (Brian Matthews) writes: >ANSI enums, on the other hand, are >little more than fancy #defines (although you can: a - insert new ones in the >middle without renumbering the others by hand and b - have the compiler tell >you how many there are.) How do you get the compiler to tell you how many values an enumerated type has? Does this just refer to defining a final value, like enum days_of_week = {SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, N_DAYS_OF_WEEK }; or is there something more subtle? ----------------------------------------------------------------------------- | David C. Brown | uunet!mnetor!motto!dave | | Motorola Canada, Ltd. | 416-499-1441 ext 3708 | | Communications Division | "Of course I'm above average! Who isn't?" | -----------------------------------------------------------------------------