Developer community
0 votes
48 views
asked by Guru (24.6k points) 30 54 84 | 48 views

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 by Guru (39.1k points) 10 22 36

Related questions

0 votes
1 answer
+1 vote
1 answer
asked by steve Sr Member (1.5k points) 8 23 36 | 43 views
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

Categories


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

3.8k questions

4k answers

117 comments

10.7k users

3,754 questions
4,046 answers
117 comments
10,709 users