I have a doubt in C! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

I have a doubt in C!

In enum function we have (say) a,b,c,d then if we mark b=10 then does it imply that c should be always greater than 11 if c is also mentioned to be 3(for some value which is less than b)? Please clarify my doubt and I am stuck with this illustration about the enum function!

11th Dec 2020, 1:52 PM
Ujwal Sai Simha Y
Ujwal Sai Simha Y - avatar
4 Answers
+ 3
This is fine enum myenum{a, b = 10, c = 3, d}; a = 0; d = 4;
11th Dec 2020, 2:00 PM
rodwynnejones
rodwynnejones - avatar
+ 2
rodwynnejones Thanks sir!
11th Dec 2020, 2:05 PM
Ujwal Sai Simha Y
Ujwal Sai Simha Y - avatar
+ 2
yes if you mark b=10 automatically c=11, d=12 and a=0.. and also you can assign 3 to c, so d would be 4 and so one.. so if : enum val{a, b, c=5, d, e, f=0, g}; --> a=0 b=1 c=5 d=6 e=7 f=0 g=1
11th Dec 2020, 2:13 PM
Amine Laaboudi
Amine Laaboudi - avatar
+ 2
Amine Laaboudi Yeah thanks for clearing my doubt!
11th Dec 2020, 2:20 PM
Ujwal Sai Simha Y
Ujwal Sai Simha Y - avatar