Bifalgorithm post · Computer science one · Enumerated Types
How do you declare an enumerated type in C?
How do you declare an enumerated type in C? (Computer science one · Enumerated Types) — "C allows you to define enumerated types which allow you to define a fi…
Ideas in this flowchart
- C enumerated types define named sets of possible values.
- An enumerated type defines a fixed list of possible values.
- Days of the week and months of the year are typical values used in dates.
- These values are more or less fixed and are not expected to change frequently.
- The values use human-readable keywords, much like a #define macro.
- An enumerated type is declared with the keywords typedef enum.
- A comma-delimited list of keywords is placed inside a code block.
- The type identifier is written after the code block.
- The identifier names the type and can later be used to declare variables.
- The example declares DayOfWeek with the values SUNDAY through SATURDAY.