Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - Why does C use %u to represent-1 and output 65535?
Why does C use %u to represent-1 and output 65535?
%u is an unsigned integer with unsigned decimal output, and the range of numbers can be 0-65535, that is, the corresponding binary number is 0-1111165438.

-1 is a signed integer of11111165438+. (-1 is expressed in binary as1000000001,and negative numbers are expressed in computer with the complement, that is,1165438. If the-1 output with %d is normal, but converted into unsigned integer %u output,1111/kloc-0. 38+0 1 1 1 1 1 1 1 1 1 1 1 165438+