C Books Guide and List
C++ Books Guide and List
Best Java Books

3,749 questions

4,049 answers

114 comments

10,705 users

What is an Enumeration Constant C?

0 votes
38 views
asked Jan 8, 2014 by sara Guru (24,570 points)

1 Answer

0 votes
Enumeration is a data type. We can create our own data type and define values that the variable can

take. This can help in making program more readable. enum definition is similar to that of a structure.

Example: consider light_status as a data type. It can have two possible values - on or off.

enum light_status

{

on, off

};

enum light_status bulb1, bulb2;

/* bulb1, bulb2 are the variables */

Declaration of enum has two parts:

a) First part declares the data type and specifies the possible values, called 'enumerators'.

b) Second part declares the variables of this data type.

We can give values to these variables:

bulb1 = on;

bulb2 = off;
answered Jan 8, 2014 by rajesh Guru (39,140 points)

Related questions

0 votes
1 answer 1,560 views
0 votes
1 answer 1,128 views
+1 vote
1 answer 42 views
42 views asked Jul 12, 2011 by steve Sr Member (1,460 points)
...