我想找出 (short / int / long / float / double / long double / char) 的大小,所以我写了这段代码:
printf("short\t\t%d\n", sizeof(short));
printf("int\t\t%d\n", sizeof(int));
printf("long\t\t%d\n", sizeof(long));
printf("float\t\t%d\n", sizeof(float));
printf("double\t\t%d\n", sizeof(double));
printf("long double\t%d\n", sizeof(long double));
printf("char\t\t%d\n", sizeof(char));
但输出是:
type bytes
short 512
int 512
long 1024
float 1024
double 1024
long double 1024
char 256
为什么字节数这么大?
不应该是2、8、...吗?