Q:

What do you mean by enumeration in C?

0

What do you mean by enumeration in C?

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Ans:

An enum in C is a user-defined data type. It consists set of named constant integers. Using the enum keyword, we can declare an enumeration type by using the enumeration tag (optional) and a list of named integer.

Basically, we used the enum to increase the code readability and with enum easy to debug the code as compared to symbolic constant (macro). The most important property of enum is that it follows the scope rule and the compiler automatically assigns the value to its member constant.

Note: A variable of enumeration type stores one of the values of the enumeration list defined by that type.

Syntax of enum,

enum Enumeration_Tag { Enumeration_List };

The Enumeration_Tag specifies the enumeration type name.

The Enumeration_List is a comma-separated list of named constant.

Example,

enum FLASH_ERROR { DEFRAGMENT_ERROR, BUS_ERROR};

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
What does the keyword const mean?... >>
<< What is the output of the below C code?...