Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - The storage form of integers in memory in C language
The storage form of integers in memory in C language
Both unsigned integers and signed positive integers are represented by binary source code, and negative integers are represented by complement (algorithm of complement: add 1 after the original code of negative absolute value is inverted). For example:

Suppose the machine uses 16 bits to store integers.

The existing form of 10 is 0000000010/0.

The existing form of-10:

(1) |-10| =10,10 The original code was 00000000010.

(2) The position is reversed:111111165438.

(3) Add1:11111165438+.