各类型的sizeof()值

参考一:

sizeof (char unsinged char   singed char ) =1     字符类型规定为1

sizeof ()

[signed] int                    2     16bit

unsinged int                    2

[signed]short [int]             2

unsigned short [int]            2

[singed] long [int]             4     32bit

unsigned long [int]             4

float                           4     

double                          8    64bit

long double                     16   128bit

 

sizeof(数组) = 数组长度

 

sizeof(指针) = 2

sizeof(结构体struct) = 所有结构字节数总和

sizeof(联合体union) = 最大成员字节数

 

 

参考二:

 

数据类型 说明 字节数 取值范围
bool 布尔型 1 true,false
char 字符型 1 -128~127
unsigned char 无符号字符型 1 0~255
short 短整型 2 -32768~32767
unsigned short 无符号短整型 2 0~65535
int 整型 4 -2147483648~2147483647
unsigned 无符号整型 4 0~4294967295
long 长整型 4 -2147483648~2147483647
unsigned long 无符号长整型 4 0~4294967295
float 单精度型 4 -3.4×10-38~3.4×10-38
double 双精度型 8 -1.7×10-308~1.7×10-308
long double 长双精度型 8 -1.7×10-308~1.7×10-308

 

posted @ 2012-08-17 23:28  CN.SnailRun  阅读(484)  评论(0编辑  收藏  举报