+ 1
Can anyone help me with with this enumerations..
enum{ MANGO=5, BANANA=4, PEACH }; printf("%d",peach); Options are given below.. A) 3 B) 0 C) compilation error D) 5
9 Answers
+ 6
Each value in an enum is the value of the preceding element + 1. If you don't assign any values to the elements, they are numbered starting from 0:
enum {
A,
B,
C = 5,
D,
E = 14
};
Here, A will be 0, B will be 1, C will be 5, D will be 6 and E will be 14
+ 3
Naveen Maurya is right but if you had used Peach in the print the answer would be 5 as it immediately follows Banana in the enumeration which has a value of 4.
+ 3
Thanks Anna..i got it..đđ
+ 1
I guess it leads to an error (C) as enumerations should be case-sensitive.
+ 1
Sonic, is that true? I did not know that.
+ 1
Yep..Am sorry guys ... They're all in upper case...
+ 1
Sonic,yep ur answer is correct.
Can u explain in detail...please...
As peach is not assigned to any value,it should return an error.. isn't it ...
0
Still a compilation error since you cannot use a ; inside an enum
0
Anna,now it's correct..what about the explanation of output..



