首页 > 代码库 > 在C语言中,double long unsigned int char 类型数据所占字节数

在C语言中,double long unsigned int char 类型数据所占字节数

在C语言中,double  long  unsigned  int  char  类型数据所占字节数和机器字长及编译器有关系:所以,int,long int,short int的宽度都可能随编译器而异。但有下面几条原则(ANSI/ISO制订的): 
1 sizeof(short int)<=sizeof(int) 
2 sizeof(int)<=sizeof(long int) 
3 short int至少应为16位(2字节) 
4 long int至少应为32位。 
unsigned 是无符号的意思。
具体如下表格
所占空间字节数
 16位编译器
32位编译器
64位编译器
char1byte1byte1byte
char *(指针变量)2byte4byte8byte
short int
2byte2byte2byte
int
2byte4byte4byte
unsigned int
2byte4byte4byte
float4byte4byte4byte
double
8byte8byte8byte
long
4byte4byte8byte
long long
8byte8byte8byte
unsigned long4byte4byte8byte

在C语言中,double long unsigned int char 类型数据所占字节数