C++ 常见类型位数、长度及范围
source link: https://exp-blog.com/lang/cpp-chang-jian-lei-xing-wei-shu-chang-du-ji-fan-wei/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
C++ 常见类型位数、长度及范围
类型
位数n
长度 = 字节 =
sizeof∗ = n/8
值范围
bool 8 1 0 false 或 1 true
char
8
1
0∼28−1
(即0~255,相当于ASCII码范围)
char* 32 4
int 32 4 −216∼216−1
int* 32 4
unsigned int 32 4 0∼232−1
long int 32 4 −216∼216−1
unsigned long int 32 4 0∼232−1
short int 16 2 −28∼28−1
unsigned short int 16 2 0∼216−1
float 32 4 −3.4x10−38∼3.4x1038
float* 32 4
double 64 8 −1.7x10−308∼1.7x10308
long double 64 8 −1.2x10−4932∼1.2x104932
double* 32 4
double& 32 4
enum 32 4
void
用
sizeof(void)
计算空类型大小是非法的,说明void
无任何信息
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK