The C standard does not specify which basic type should be how many bytes, which is also related to OS and compiler. For example, it is also a 32-bit operating system, and the int type is 4 bytes under VC++ compiler and 2 bytes under tuborC.
Although there are different types of integer types in 16-bit, 32-bit or 64-bit computers, there are several rules (formulated by ANSI/ISO):
Short takes up at least 2 bytes.
Int is recommended as machine word length, 4 bytes in 32-bit environment and 8 bytes in 64-bit environment.
The length of short cannot be greater than int, and the length of long cannot be less than int.
Extended data
Integer data can be divided into basic integer (int), short integer (short int), long integer (long int) and newly added double long integer (long long int).
Basic Shaping (int): Generally, it takes 2 or 4 bytes, depending on the compiling system. Generally speaking, in vc, the computer allocates 4 bytes to it, and the integer data is generally stored in the computer in the form of complement.
Short int: In vc, the memory size allocated by the computer to short int is 2 bytes. The storage mode is the same as the basic form. The data range of short integers is: -32768-32767.
Long int: In vc, the system assigns it 4 bytes, and the value range of a Long int is -2 3 1 power to 2 3 1 power minus one.
Long long int: In vc, the system allocates 8 bytes to it, which is rarely used.