Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - What is the specific difference between intshortlong and C language?
What is the specific difference between intshortlong and C language?
These three types are different in type definition, number of bytes occupied and data range.

1, different definitions

Int type is called integer.

Short types are called short integers;

Long type is called long integer;

2. The number of bytes occupied is different.

Two bytes); of the shortint variable;

Four bytes of type int (in a 32-bit machine);

Longint takes 8 bytes (in a 32-bit computer);

3. Different data ranges

The value of the shortint type variable is -( 16 to the second power)+1 to (15 to the second power)-1;

The value of an int variable is -(2 to the 32nd power)+1 to (2 to the 3rd1power)-1;

The value of the long variable is -(2 to the 64th power)+1 to (2 to the 63rd power)-1;

Extended data

1, the specific occupation of several bytes is not specified in C language, but it is widely defined in C language:

1), and the shortint type takes at least 2 bytes.

The type of int is suggested to be machine word length. The machine word length is 4 bytes in 32-bit environment and 8 bytes in 64-bit environment.

3) The length of short type cannot be greater than int, and the length of long type cannot be less than int.

reference data

Baidu encyclopedia -C language