Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - How many bytes does an int occupy?
How many bytes does an int occupy?
Int occupies 4 bytes.

Single-chip microcomputer is commonly used. Short type and int type have at least 16 bits, and long type has at least 32 bits. 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.

Extended data:

Int is a function that rounds numbers down to the nearest integer. INT is an integer function among the common functions in the database, which is often used to judge whether one number can be divisible by another.

Use programming languages (C, C++, C#, Java, etc. ), which is often used to define the identifier of an integer variable.

In a general computer, int occupies 4 bytes and 32 bits, and the data range is-2147483648 ~ 2147483647 [-231~ 231];

In the previous microcomputer, int occupied 2 bytes, with 16 bits, and the data range was-32768 ~ 32767 [-215 ~ 215-1];

Use printf to output the number of bytes occupied by int:

printf("%d ",sizeof(int));

In addition to int types, there are short, long, long? A long integer can represent an integer.

Not signed? int? Represents an unsigned integer with a data range of [0 ~ 2 32-1].

Baidu Encyclopedia -INT (data type)