[英]Is it possible to get the address of memory in under memory?
I know that we can read the location/position of a variable and its value in the memory but I want to go more deeper to see where is this memory address located if it is possible.我知道我们可以读取变量的位置/位置及其在内存中的值,但如果可能的话,我想更深入地查看此内存地址位于何处。 In my case 0x61fe09 is the memory address for a and what is the memory address for 0x61fe09 .
在我的情况下, 0x61fe09是a的内存地址, 0x61fe09的内存地址是什么。
code:代码:
#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;
}
There's no memory address for &a
because it's not stored in memory. &a
没有内存地址,因为它没有存储在内存中。
You could store it in memory like so:你可以像这样将它存储在内存中:
int* pointer_to_a = &a;
Now you can print &pointer_to_a
to see the address where you stored &a
.现在您可以打印
&pointer_to_a
以查看您存储&a
的地址。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.