265 views
1 votes
1 votes
main()
{
int x=68;
char y='D';
if (x!=y)
printf("true");
else
printf("false");
}

the output is coming false. but why?

according to me the base address is compared so answer should be true?

1 Answer

0 votes
0 votes

character variable holds ASCII value rather than that character itself in C programming and ascii value of D is 68. 

in the loop (x!=y) means (68!=68) which is FALSE so value for comparison becomes (0) .

Hence it prints FALSE

No related questions found