#include <iostream>
using namespace std;
struct A
{
int& a;
};
int main() {
int a = 5;
cout << (void*)&a << ' ';
A* b = nullptr;
{
int& c = a;
cout << (void*)&c << ' ';
b = new A{ c };
int* d = (int*)((void*)b);
*d = 0;
cout << "ref address: " << (void*)d << ' ';
}
cout << (void*)&(b->a) << ' ';
// your code goes here
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKc3RydWN0IEEKewoJaW50JiBhOwp9OwoKaW50IG1haW4oKSB7CglpbnQgYSA9IDU7Cgljb3V0IDw8ICh2b2lkKikmYSA8PCAnICc7CglBKiBiID0gbnVsbHB0cjsKCXsKCQkKCQlpbnQmIGMgPSBhOwoJCWNvdXQgPDwgKHZvaWQqKSZjIDw8ICcgJzsKCQliID0gbmV3IEF7IGMgfTsKCQkKCQlpbnQqIGQgPSAoaW50KikoKHZvaWQqKWIpOwoJCSpkID0gMDsKCQljb3V0IDw8ICJyZWYgYWRkcmVzczogIiA8PCAodm9pZCopZCA8PCAnICc7CgkJCgl9Cgljb3V0IDw8ICh2b2lkKikmKGItPmEpIDw8ICcgJzsKCQoJLy8geW91ciBjb2RlIGdvZXMgaGVyZQoJcmV0dXJuIDA7Cn0=