char:1byte;
short:2byte;
int:4byte;
longint:4byte;
float:4byte;
double:8byte;
字符数组:len*1;
int 数组:len*4
例如:如下的c++函数,求一下集中变量的内存单元
#include<iostream> #include<string> usingnamespacestd;
void main(void)
{
int i; unsignedint j;short k; longint l; double m; float n; char st;
int mm[100];
cout<<"The length of int is:"<<sizeof(i)<<endl;
cout<<"The length of uint is:"<<sizeof(j)<<endl;
cout<<"The length of short is:"<<sizeof(k)<<endl;
cout<<"The length of long int is:"<<sizeof(l)<<endl;
cout<<"The length of double is:"<<sizeof(m)<<endl;
cout<<"The length of float is:"<<sizeof(n)<<endl;
cout<<"The length of float is:"<<sizeof(st)<<endl;
cout<<"The length of int mm[100] is:"<<sizeof(mm)<<endl;
system("pause");
}