in the statement 'if(a== (1==2))' as far as i know (1==2) will result in to 'false'. and it'll check if(a==false) but 'a' is not of boolean data type. so how this is going to be interpreted??
Output 14 Explanation: Here tagname (c) and constant name (c) is same but still no errors. The values for constant names, c=34 d=12 a=13 b=14 if(a==(1==2)) this is FALSE because, if (a==(0)) —> (because 1==2 is not TRUE) if (13==0) —> FALSE Hence b's value is printed
khabar nai...confused!!!!
ReplyDeleteyeh enum main aise values daal sakte hain??
ReplyDeleteHey are you sure there is no typing mistake in it???
ReplyDelete#include
ReplyDelete#include
void main()
{
enum c{c=34, d=12, a, b};
clrscr():
if(a== (1==2))
printf("%d", a);
else
printf("%d" , b) ;
}
han now its a bit clear....
ReplyDeletein the statement 'if(a== (1==2))'
ReplyDeleteas far as i know (1==2) will result in to 'false'.
and it'll check if(a==false)
but 'a' is not of boolean data type.
so how this is going to be interpreted??
Output 14
ReplyDeleteExplanation: Here tagname (c) and constant name (c) is same
but still no errors. The values for constant names,
c=34
d=12
a=13
b=14
if(a==(1==2)) this is FALSE because,
if (a==(0)) —> (because 1==2 is not TRUE)
if (13==0) —> FALSE Hence b's value is printed