关于内存地址的疑问
#include <iostream>
int main()
{
using namespace std;
int donuts = 6;
double cups = 4.5;
cout << "donuts value = " << donuts;
cout << " and donuts address = " << &donuts << endl;
cout << "cup value = " << cups;
cout << " and cups address = " << &cups << endl;
cin.get();
return 0;
}
为什么这个程序我最后在VC++2010上输出的地址差不是书上说的4位,而是10位呢,我看的书是C++ primer plus
[解决办法]
4个字节是理论上的,我这边vc6差8个字节,跟编译器的具体实现以及内存对齐都有关系