//各个数据类型的大小
#include <stdio.h>
int main(int argc, const char * argv[]) {
char k;
printf("char 占用字节:%d\n",sizeof(k));
int i=0;
printf("int 占用字节:%d\n",sizeof(i));
short j;
printf("short 占用字节:%d\n",sizeof(j));
float l;
printf("float 占用字节:%d\n",sizeof(l));
double m;
printf("double 占用字节:%d\n",sizeof(m));
}
//char 占用字节:1
//int 占用字节:4
//short 占用字节:2
//float 占用字节:4
//double 占用字节:8
转载于:https://blog.51cto.com/13413367/1973900