Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - In C language, if the data of type int takes up two bytes, define an int plastic variable, whose k value is-1, and the output value of plastic k with printf is decimal unsigned form, as follows.
In C language, if the data of type int takes up two bytes, define an int plastic variable, whose k value is-1, and the output value of plastic k with printf is decimal unsigned form, as follows.
If it is a 32-bit integer, the result is 2 32-1= 4294967295.

This is because the representation of signed integer to negative number is 2- complement, that is, the bit is inverted and the last bit is added with 1.

So-1 is expressed as 0000000000 1, and then the last digit is added with1,which is.

1 1 1 1 1 1 1 1 1 1 1 1 1 1 10 + 1 = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

The latter is converted into an unsigned integer, that is, 2 32-1.