源码测试
1 // typesize.c -- 输出类型的大小 2 #include <stdio.h> 3 int main(void) 4 { 5 //C99为类型大小提供一个%zd说明符 6 7 printf("Type int has a size of %u bytes. \n", sizeof(int)); 8 printf("Type char has a size of %u bytes. \n", sizeof(char)); 9 printf("Type long has a size of %u bytes. \n", sizeof(long)); 10 printf("Type double has a size of %u bytes. \n", sizeof(double)); 11 12 return 0; 13 14 }