How on earth can
give 0? Shouldnt z get printed as INT_MAX - 1?Code:int z = -1;
printf("%d\n", ~z);
Printable View
How on earth can
give 0? Shouldnt z get printed as INT_MAX - 1?Code:int z = -1;
printf("%d\n", ~z);
Most architectures use 2's complement for signed integers, and in that system -1 is represented by all bits on.
Oh. So the bigest integral negative number (INT_MIN) is represented as all zeroes?
All zeroes is 0. A one, followed by 15/31/63 zeroes, is the most negative number in a 2's complement system.