I am trying to run the following code, but am confused by what is going on here:
int main()
{
if(-1 == 0xffffffff )
printf("-1 is equal to maximum\n");
else
printf(" -1 is not equal to maximum\n");
if(0xff < -1)
printf(" Less than -1 \n");
if(0xff < 0xffffffff)
printf(" Less than maximum\n");
I also tried with a comment and replaced -1 with "a" and 0xffffffff with "b", but the result is the same.
This is a 32-bit system, so I took an integer size of 4 bytes.
My way out:
-1 is equal to maximum
Less than maximum
If -1 is equal to the maximum, then it must execute both of the last two if statements. But this does not happen. Why?
source
share