Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - How many bytes does the data type int occupy in memory?
How many bytes does the data type int occupy in memory?
The data type int in a general compiler is 4 bytes;

Short and int types have at least 16 bits, and long types have at least 32 bits, and the length of short type cannot exceed that of int type, and the length of int type cannot exceed that 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 (such as GCC).

Under the GCC compiler, the number of bytes of various types of variables for 32-bit machines and 64-bit machines is as follows:

Int is an alias for System. Int32, whose type is struct.

Moreover, its internal storage mode is not disclosed, so it can only be said to be at least 4 bytes, but it may be more (members of the parent class Object and ValueType).