数据类型名称 | 字节数 | 别名 | 取值范围 |
int | * | signed,signed int | 由操作系统决定,即与操作系统的"字长"有关 |
unsigned int | * | unsigned | 由操作系统决定,即与操作系统的"字长"有关 |
__int8 | 1 | char,signed char | –128 到 127 |
__int16 | 2 | short,short int,signed short int | –32,768 到 32,767 |
__int32 | 4 | signed,signed int | –2,147,483,648 到 2,147,483,647 |
__int64 | 8 | 无 | –9,223,372,036,854,775,808 到 9,223,372,036,854,775,807 |
bool | 1 | 无 | false 或 true |
char | 1 | signed char | –128 到 127 |
unsigned char | 1 | 无 | 0 到 255 |
short | 2 | short int,signed short int | –32,768 到 32,767 |
unsigned short | 2 | unsigned short int | 0 到 65,535 |
long | 4 | long int,signed long int | –2,147,483,648 到 2,147,483,647 |
long long | 8 | none (but equivalent to __int64) | –9,223,372,036,854,775,808 到 9,223,372,036,854,775,807 |
unsigned long | 4 | unsigned long int | 0 到 4,294,967,295 |
enum | * | 无 | 由操作系统决定,即与操作系统的"字长"有关 |
float | 4 | 无 | 3.4E +/- 38 (7 digits) |
double | 8 | 无 | 1.7E +/- 308 (15 digits) |
long double | 8 | 无 | 1.7E +/- 308 (15 digits) |
wchar_t | 2 | __wchar_t | 0 到 65,535 |
类型标识符 | 类型说明 | 长度(字节) | 范围 | 备注 |
char | 字符型 | 1 | -128 ~ 127 | -27 ~ (27 -1) |
unsigned char | 无符字符型 | 1 | 0 ~ 255 | 0 ~ (28 -1) |
short int | 短整型 | 2 | -32768 ~ 32767 | 2-15 ~ (215 - 1) |
unsigned short int | 无符短整型 | 2 | 0 ~ 65535 | 0 ~ (216 - 1) |
int | 整型 | 4 | -2147483648 ~ 2147483647 | -231 ~ (231 - 1) |
unsigned int | 无符整型 | 4 | 0 ~ 4294967295 | 0 ~ (232-1) |
float | 实型(单精度) | 4 | 1.18*10-38 ~ 3.40*1038 | 7位有效位 |
double | 实型(双精度) | 8 | 2.23*10-308 ~ 1.79*10308 | 15位有效位 |
long double | 实型(长双精度) | 10 | 3.37*10-4932 ~ 1.18*104932 | 19位有效位 |