How many bytes does int occupy (c language)?

烟雨青岚
Release: 2020-07-15 15:38:38
Original
53287 people have browsed it

int occupies two bytes in a 16-bit compiler, and int occupies four bytes in a 32-bit compiler. "int" is the type name of the integer type, and the type name of the long integer is "long int", which can be abbreviated as "long". "int" and "long" are both keywords.

How many bytes does int occupy (c language)?

int occupies two bytes in a 16-bit compiler, and int occupies four bytes in a 32-bit compiler.

1. 16-bit compiler

char: 1 byte char* (pointer variable): 2 bytes short int: 2 Byte int: 2 bytes unsigned int: 2 bytes float: 4 bytes double: 8 bytes long: 4 bytes long long: 8 bytes unsigned long: 4 bytes

2. 32-bit compiler

char: 1 byte char*: 4 bytes short int: 2 bytes int: 4 bytes unsigned int: 4 bytes float: 4 bytes double: 8 bytes long: 4 bytes long long: 8 bytes unsigned long: 4 bytes

How many bytes does int occupy (c language)?

Extended information:

The general classification of integer data is as follows:

1. Basic type: The type specifier is int, which occupies 2 bytes in memory.

2. Short integer type: The type specifier is short int or short. The occupied bytes and value range are the same as those of the basic type.

3. Long integer type: The type specifier is long int or long, which occupies 4 bytes in memory.

4. Unsigned type: The type specifier is unsigned. The unsigned type can be formed by matching the above three types:

1) Unsigned basic type: The type specifier is unsigned int or unsigned.

2) Unsigned short integer type: The type specifier is unsigned short.

3) Unsigned long integer: The type specifier is unsigned long.

Recommended tutorial: "C Language Tutorial"

The above is the detailed content of How many bytes does int occupy (c language)?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template