C语言6种基本数据类型:short、int、long、char、float、double;
用sizeof来测试测试字节长度
# include <stdio.h> int main (void) { printf("int=%d\n",sizeof( short int)); printf("int=%d\n",sizeof(int)); //测试int行的长度 printf("long int=%d\n",sizeof(long int)); printf("char=%d\n",sizeof(char)); printf("float=%d\n",sizeof(float)); printf("double=%d\n",sizeof(double)); return 0; } /*用sizeof测试字节长度 注:sizeof的用法 sizeof(int) */ |