首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 计算机考试 > 等级考试 > 复习指导 >

C语言基础

2008-12-30 
C标准类型的长度bytes

    WIN2K/VC下面:

  [char] Size Total:1

  [int] Size Total:4

  [long int] Size Total:4

  [float] Size Total:4

  [double] Size Total:8

  [long double] Size Total:8

  [double point]Size Total:4

  [char point] Size Total:4

  WIN2K/dev-c++下面 &

  Ubuntu8.10 gcc 下面:

  [char] Size Total:1

  [int] Size Total:4

  [long int] Size Total:4

  [float] Size Total:4

  [double] Size Total:8

  [long double] Size Total:12

  [double point]Size Total:4

  [char point] Size Total:4

  SUN Ultra10 Solairs8(32bit)GUNgcc:

  [char] Size Total:1

  [int] Size Total:4

  [long int] Size Total:4

  [float] Size Total:4

  [double] Size Total:8

  [long double] Size Total:16

  [double point]Size Total:4

  [char point] Size Total:4

  结论 long double类型,Solairs的gcc下最长;VC最短。科学计算慎用VC。

  #include

  #include

  main()

  {

  char c;

  int i;

  long int j;

  float k;

  double l;

  long double m;

  char *cp;

  double *lp;

  printf("[char] Size Total:%d\n",sizeof(c));

  printf("[int] Size Total:%d\n",sizeof(i));

  printf("[long int] Size Total:%d\n",sizeof(j));

  printf("[float] Size Total:%d\n",sizeof(k));

  printf("[double] Size Total:%d\n",sizeof(l));

  printf("[long double] Size Total:%d\n",sizeof(m));

  printf("[double point]Size Total:%d\n",sizeof(cp));

  printf("[char point] Size Total:%d\n",sizeof(lp));

  printf("\nThe done.\n");

  getc(stdin);

  }

 

3COME考试频道为您精心整理,希望对您有所帮助,更多信息在http://www.reader8.com/exam/

热点排行