C++ 变量复习(字节占用与范围)
变量类型 | 编译器 | 占用字节 | 取值范围 |
char | x32 | 1 | -128~127(0~255) |
short(short int) | x32 | 2 | -2^15~2^15-1(0~2^16-1) |
int | x32 | 4 | -2^31~2^31-1(0~2^32-1) |
long(long int) | x32 | 4 | -2^31~2^31-1(0~2^32-1) |
long long | x32 | 8 | -2^63~2^63-1(0~2^64-1) |
float | x32 | 4 | -3.4E-38~3.4E+38 |
double | x32 | 8 | -1.7E-308-1.7E+308 |
指针 | x32 | 4 | - |
char | x64 | 1 | -128~127(0~255) |
short(short int) | x64 | 2 | -2^15~2^15-1(0~2^16-1) |
int | x64 | 4 | -2^31~2^31-1(0~2^32-1) |
long(long int) | x64 | 8 | -2^63~2^63-1(0~2^64-1) |
long long | x64 | 8 | -2^63~2^63-1(0~2^64-1) |
float | x64 | 4 | -3.4E-38~3.4E+38 |
double | x64 | 8 | -1.7E-308-1.7E+308 |
指针 | x64 | 8 | - |
留言评论
暂无留言