Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - In C language, do unsigned numbers need to be reversed and added with one?
In C language, do unsigned numbers need to be reversed and added with one?
In c language, numerical values are expressed by complement: the complement of positive numbers is the same as the original code; The complement of a negative number: The binary form of the absolute value of this number is bitwise negation and addition 1.

1. The data stored in the computer is stored in the form of two's complement, and the positive complement is itself (for example, there is binary 00000 1 10, because its first bit is 0, which means it is a positive number, and its complement and complement are both itself).

2. The complement of a negative number is its complement plus 1, that is, you say' take the inverse and add one' (for example, there is binary 1 00010, the first bit is1,which means it is a negative number, and the complement is the inverse of each bit.