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 .
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.
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
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.