Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - Why is int a=- 1 printf("%o ",a) equal to 177777 in C language?
Why is int a=- 1 printf("%o ",a) equal to 177777 in C language?
It can be seen that the integer length of the computer is two bytes, that is, the shaping data of 16 bits and-1 are stored in the computer together with the complement, which is 16 blocks 1. That is,111111165438+. Hexadecimal and octal have no direct "negative" sign, and both use complement, so when the integer-1 is formatted with the octal format character "%O", the input becomes 177777.