Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - Negative numbers are stored by complement in C language, how to read them?
Negative numbers are stored by complement in C language, how to read them?
1, negative number is its complement form in the computer = original code anti+1.

An 8-bit byte can represent a value ranging from-128 to+127.

It is expressed in binary, that is,10000000-011111(Note: the highest bit indicates the symbol).

Everything with the highest bit of 1 is negative, and everything with the highest bit of 0 is positive.

2. For example, the original code of -7 is100011,and then it is inverted (the highest bit is the same), which is11000.

Add one to get111001,then the binary number of -7 is11.

Another example is-10. The original code is 1000 10 10, and the reverse code is11010. Add one to get 165438.

Then the binary number of-10 is111kloc-0/10.

A binary number is a binary one, with only 0 and 1 and no 2.