Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Integer data int in C language takes up several bytes.
Integer data int in C language takes up several bytes.
Different compilers occupy different bytes, as shown in the following table:

Compiler can choose the appropriate size according to its own hardware, but it needs to meet the constraints: short and int types should be at least 16 bits, long types should be at least 32 bits, and the length of short type should not exceed the length of int type, and int type should not exceed the length of long type. That is to say, the length of each type of variable is determined by the compiler, but in the current mainstream compilers, the type of int in 32-bit machines and 64-bit machines is generally 4 bytes.

Extended data:

When using different compilers, we need to pay attention to their data type differences, and so should other data types such as int, because no one specifies how many bytes a data type should occupy and whether the data it represents is signed or unsigned. Even if someone specifies these contents, no one can say whether the compiler is willing to implement them according to the regulations.

References:

Baidu Encyclopedia-Integer Data