Enumerations in C: Syntax and Examples

Enumeration is a valid list of named integer constants of a particular type of a variable. It is used to define a compiler’s symbol table. It is also used to check whether a program is valid.


enum enum_type_name { enumeration list } variable_list;

For Example: Enumeration of primary colors in RGB model:

enum primary_rgb { red, green, blue};

For a variable declaration, color:

enum primary_rgb  color;

Leave a Reply