Sign up to request clarification or add additional context in comments.
Comments
1
The result of ~1010 is not 0101 but 11111111111111111111111111110101. All 32 bits of the value are reversed, not only the bits up to the highest set bit.
As the 32nd bit is set in the result, it's negative.
printf("%u\n", a);and try again.