Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - How to define a 32-bit signed integer in C language
How to define a 32-bit signed integer in C language
According to different computer systems and compilation systems, the definition of 32-bit signed integer will be slightly different. The usual practice is to define long data as 32 bits, and the int type can be 16 bits or 32 bits.

C language does not specify the number of bytes of all kinds of data, only requires that the length of long type data is not shorter than that of int type, and short type data is not longer than that of int type. How to achieve this depends on each computer system.

For example, in Turbo C++, both int and short data are 16 bits (referring to binary bits, the same below), while long data is 32 bits. And vision? The int data or long data of C++6.0 are all 32 bits, and its short data allocation is 16 bits.

Extended data

Integer data classification:

Char: Character data, which is an integer data and occupies one byte.

Unsigned char: unsigned character data, which is a kind of integer data and occupies one byte.

Short: short integer data, which belongs to one kind of integer data and occupies two bytes.

Unsigned short integer: unsigned short integer data, which belongs to a kind of plastic data and occupies two bytes.

Int: Integer data, which belongs to one kind of integer data and occupies four bytes.

Unsigned int: unsigned integer data, which belongs to one kind of integer data and occupies four bytes.

Long: long integer data, which belongs to one kind of integer data and occupies four bytes.

Unsigned long integer: unsigned long integer data, which belongs to a kind of plastic data and occupies four bytes.

C language programming (3rd edition) Tan Haoqiang? Tsinghua University Publishing House Chapter III Data Types, Operators and Expressions? 3.3 Integer data

Baidu Encyclopedia-Integer Data