Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - int x = 20printf("%d\n ",~ x); Can you explain it to me in binary?
int x = 20printf("%d\n ",~ x); Can you explain it to me in binary?
On a normal machine, int is 4 bytes, 20 = 0x000000014 = 000000000000000000000000100b.

~x is 0xfffffeb =111111165438. 5438+0 1 1 1 1 1 1 1 10 10 10 1 1b

Numbers on ordinary computers are stored in the form of complement, so this value is -2 1, and the printed number is -2 1.