
42 Data Structures Using C
{
case chair : cost = 250; break;
case table : cost = 700; break;
case stool : cost = 120; break;
case desk : cost = 1500; break;
}
:
Similarly, enumerated data types can also be used as a control variable in a for loop as shown
below:
:
for (item = chair; item <= desk; item++)
{
:
:
}
The enumerations are also called symbolic constants because an enumeration has a name and
an integer value assigned to it which cannot be changed in the program. Therefore, enumerated
data types cannot be plainly used in I/O statements. As a result, the statements scanf, printf,
gets, puts, etc. cannot