[英]Is it possible to get the address of memory in under memory?
我知道我们可以读取变量的位置/位置及其在内存中的值,但如果可能的话,我想更深入地查看此内存地址位于何处。 在我的情况下, 0x61fe09是a的内存地址, 0x61fe09的内存地址是什么。
代码:
#include <iostream>
using namespace std;
int main()
{
int a = 42;
int* adress_of_a = &a;
int** adress_of_adress_of_a = &adress_of_a;
cout << " a = " << a << " at memory address = " << &adress_of_adress_of_a << '\n';
return 0;
}
&a
没有内存地址,因为它没有存储在内存中。
你可以像这样将它存储在内存中:
int* pointer_to_a = &a;
现在您可以打印&pointer_to_a
以查看您存储&a
的地址。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.