程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> C語言 >> C++ >> 關於C++ >> C標准類型的長度bytes

C標准類型的長度bytes

編輯:關於C++

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 <math.h>
#include <stdio.h>
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);
}

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved