1,286 views

1 Answer

Best answer
3 votes
3 votes
See the logic here

char boolean[][6]={"TRUE","FALSE"};
printf("%s",boolean[(unsigned int)-1 == ~0]);
(unsigned int)-1// converting -1 to an equivalent unsigned integer value i.e 
the max value of unsigned int.
~0 // The bitwise complement operator ~ flips every bit .~0 means all 0 bits
are flips to 1 then here also we get same value as above i.e max value of unsigned int.

Finally (unsigned int)-1== ~0 becomes true and it displays.

First element of boolean array will be printed.

FALSE

selected by

Related questions