Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - int i=-2, if i is converted into an unsigned type, it becomes 65534. How is this converted?

Positive numbers less than 32768 remain unchanged. For negative numbers, the sum of the absolute va

int i=-2, if i is converted into an unsigned type, it becomes 65534. How is this converted?

Positive numbers less than 32768 remain unchanged. For negative numbers, the sum of the absolute va

int i=-2, if i is converted into an unsigned type, it becomes 65534. How is this converted?

Positive numbers less than 32768 remain unchanged. For negative numbers, the sum of the absolute values ??of the two is 65536 (2 to the 16th power). Please also explain that integer numbers in your compiler use two words. In the binary representation of

-2, 11111111 11111101, the corresponding unsigned type is 65534 in decimal

2+65534 = 65536 = 2^^16