[ad_1]
int main()
{
int a = 2147483647;
int c = a + a + 2;
printf("2a + 2 = %d, !(2a + 2) = %d, !c = %d\n", (2 * a + 2), !(a + a + 2), !c);
}
I got this when I run those codes above
2a + 2 = 0, !(2a + 2) = 0, !c = 1
a is Tmax which in binary form is 0111…111, so a + a + 2 is suposed to be 0000…0000.
I don’t understand why !(2a + 2) is not equal to 1 when (2a + 2) is actually 0, but !c is 1!!!
Please help me
[ad_2]