% u- is the output form of unsigned plastic data.
The binary representation of 16 of +32767 is 011111165438+.
32768 = 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1+ 1+0 = 65438
If the output is in the form of %u, the compilation system you use should handle it like this:
(1) First, the short int is implicitly converted into an int, which takes up 2 bytes and 4 bytes, so it is necessary to expand the sign bit. Because the sign bit is 1, all high 16 bits of int are extended with 1, so the value stored in the memory is:
1 1 1 1 1 1 1 1 1 1 1 1 165438.
(2) Because the output is in the format of %u, the compilation system regards the sign bits as digital bits, so
1 1 1 1 1 1 1 1 1 1 1 1 165438.
4294934528。