in VS2010
#include <iostream>
using namespace std;
int main()
{
char a;
int b;
long c;
float d;
double e;
cout <<sizeof(a)<<endl;
cout <<sizeof(b)<<endl;
cout <<sizeof(c)<<endl;
cout <<sizeof(d)<<endl;
cout <<sizeof(e)<<endl;
cout <<sizeof(&a)<<endl;
cout <<sizeof(&b)<<endl;
cout <<sizeof(&c)<<endl;
cout <<sizeof(&d)<<endl;
cout <<sizeof(&e)<<endl;
}
结果输出是
1
4
4
4
8
4
4
4
4
4
想请问的就是这行 cout <<sizeof(&e)<<endl;
double e 所以 sizeof(e) = 8
但是为什么 sizeof(&e) 却是 4
要怎么在4 bytes 里面装上一个 8 bytes的东西?
求解答~ 谢谢各位大大