第1个回答 2019-03-18
各数据类型所占字符数如下:
int
4字节
float
4字节
double
8字节
long
4字节
unsigned
long
4字节
可以通过如下的语句进行验证。
printf("%d\n", sizeof(int)); // 计算int型所占字节数
printf("%d\n", sizeof(float)); // 计算float型所占字节数
printf("%d\n", sizeof(double)); // 计算double型所占字节数
printf("%d\n", sizeof(long)); // 计算long型所占字节数
printf("%d\n", sizeof(unsigned long)); // 计算unsigned long型所占字节数