Explain the term enumerations in C
A set of named integer constants is known as an enumeration. The enumeration type declaration includes the name of the enumeration tag and the definition of a set of named integers.
Ex: enum CITY { Mumbai, Bangalore, Chennai, NewDelhi } metros ;
Variables of enumeration type persists one of the existing values of the enumeration set. The enum type variables could be utilized in indexing expressions, as operands of all arithmetic and relational operators. ANSI C enum expressions are always have int type, which occupies the memory space that occupied by the int type.
Example:
enum DAY /* Defines an enumeration type */
{
saturday, /* Names day and declares a */
sunday = 0, /* variable named workday with */
monday, /* that type */
tuesday,
wednesday, /* wednesday is associated with 3 */
thursday,
friday
} workday;
saturday in the above example is associated with value 0 by default. The identifier sunday is explicitly assigned with 0. The remaining identifiers are given values 1 through 5 by default.