计算数据类型储存空间代码
#include <stdio.h>int main()
{
printf("size of short is %d\n", sizeof(short)); //短的整型
printf("size of int is %d\n", sizeof(int)); //整型(整数
printf("size of long is %d\n", sizeof(long)); //长的整型
printf("size of long long is %d\n", sizeof(long long)); //长长的整型
printf("size of flaot is %d\n", sizeof(float)); // 浮点型(小数)
printf("size of double is %d\n", sizeof(double)); //精度高的浮点型
printf("size of long double is %d\n", sizeof(long double)); //精度更高的浮点型
printf("size of char is %d\n", sizeof(char)); //字符型[(整数)对应 ASCII字符表
printf("size of _Bool is %d\n", sizeof(_Bool)); //判断真假真为1;假为0
return 0;
}
页:
[1]