What is enum ?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6
15th Dec 2017, 12:21 PM
I'm_Groot
I'm_Groot - avatar
4 Answers
+ 11
An enumeration is a user-defined data type that consists of integral constants. To define an enumeration, keyword enum is used. enum season { spring, summer, autumn, winter }; Here, the name of the enumeration is season. And, spring, summer and winter are values of type season. By default, spring is 0, summer is 1 and so on. You can change the default value of an enum element during declaration (if necessary). enum season { spring = 0, summer = 4, autumn = 8, winter = 12 };
15th Dec 2017, 12:25 PM
GAWEN STEASY
GAWEN STEASY - avatar
+ 6
it is integral constants
15th Dec 2017, 12:33 PM
GAWEN STEASY
GAWEN STEASY - avatar
+ 5
the values of spring,summer...should be integers or anyother datatype??
15th Dec 2017, 12:30 PM
I'm_Groot
I'm_Groot - avatar
+ 5
oh I see ,
15th Dec 2017, 12:36 PM
I'm_Groot
I'm_Groot - avatar