The Int type is special. The specific number of bytes is related to the machine length and compiler. To ensure portability, use _ int16 _ int32 _ int64, or use your own typedef int int32.
The C and C ++ standards only specify the minimum number of bytes of a certain type (to prevent overflow)
64-bit indicates that the data width of the general-purpose CPU register is 64-bit.
Data Type name |
Bytes |
Alias |
Value Range |
Int |
* |
Signed, signed int |
Determined by the operating system, that is, it depends on the operating system's "font" |
Unsigned int |
* |
Unsigned |
Determined by the operating system, that is, it depends on the operating system's "font" |
_ Int8 |
1 |
Char, signed Char |
-128 to 127 |
_ Int16 |
2 |
Short, short int, signed short int |
-32,768 to 32,767 |
_ Int32 |
4 |
Signed, signed int |
-2,147,483,648 to 2,147,483,647 |
_ Int64 |
8 |
None |
-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 |
Bool |
1 |
None |
False or true |
Char |
1 |
Signed Char |
-128 to 127 |
Unsigned char |
1 |
None |
0 to 255 |
Short |
2 |
Short int, signed short int |
-32,768 to 32,767 |
Unsigned short |
2 |
Unsigned short int |
0 to 65,535 |
Long |
4 |
Long int, signed long int |
-2,147,483,648 to 2,147,483,647 |
Long long |
8 |
None (but equivalent to _ int64) |
-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 |
Unsigned long |
4 |
Unsigned long int |
0 to 4,294,967,295 |
Enum |
* |
None |
Determined by the operating system, that is, it depends on the operating system's "font" |
Float |
4 |
None |
3.4e +/-38 (7 digits) |
Double |
8 |
None |
1.7e +/-308 (15 digits) |
Long double |
8 |
None |
1.7e +/-308 (15 digits) |
Wchar_t |
2 |
_ Wchar_t |
0 to 65,535 |
Type identifier |
Type description |
Length (Bytes) |
Range |
Remarks |
Char |
Character Type |
1 |
-128 ~ 127 |
-27 ~ (27-1) |
Unsigned char |
Unsigned character type |
1 |
0 ~ 255 |
0 ~ (28-1) |
Short int |
Short integer |
2 |
-32768 ~ 32767 |
2-15 ~ (215-1) |
Unsigned short int |
Unentered short integer |
2 |
0 ~ 65535 |
0 ~ (216-1) |
Int |
Integer |
4 |
-2147483648 ~ 2147483647 |
-231 ~ (231-1) |
Unsigned int |
Unsigned integer |
4 |
0 ~ 4294967295 |
0 ~ (232-1) |
Float |
Solid (single precision) |
4 |
1.18*10-38 ~ 3.40*1038 |
7-bit valid bits |
Double |
Real (Double Precision) |
8 |
2.23X10-308 ~ 1.79*10308 |
15-bit valid digits |
Long double |
Solid (long dual-precision) |
10 |
3.37X10-4932 ~ 1.18*104932 |
19-bit valid digits |