int p;
int i1;
int i2;
i1 = 1 << 16;
i2 = 1 << 8;
p = int(&i1)+3;
cout << hex;
cout << "&i1: " << int(&i1) << endl;
cout << "&i2: " << int(&i2) << endl;
for(int i = 0; i < 16; i++)
cout << p << ": " << uint(*((byte*)p--)) << endl;
输出:
&i1: 12fac8 &i2: 12fabc 12facb: 0 12faca: 1 12fac9: 0 12fac8: 0 12fac7: cc 12fac6: cc 12fac5: cc 12fac4: cc 12fac3: cc 12fac2: cc 12fac1: cc 12fac0: cc 12fabf: 0 12fabe: 0 12fabd: 1 12fabc: 0
我正在使用 Visual Studio 2010 运行 Windows 7 32 位。没什么好说的,但 stackoverflow 不会让我在没有更多“细节”的情况下发布,所以这只是无用的漫谈:)