+ 3

What is the use of enum in c language?

23rd Jan 2018, 3:54 AM
Puneet Bhardwaj
Puneet Bhardwaj - avatar
2 Answers
+ 9
It allows you to create your own names for integer data. They can be used anywhere an integer can be used. enum direction {north, east, south, west}; int d = north; printf("%d\n", d); outputs 0 They can be assigned exact values instead of sequential ones. enum data {one = 1, zero = 0, ten = 10};
23rd Jan 2018, 4:13 AM
John Wells
John Wells - avatar