c++ 获取对象地址和从地址获取对象
#include <iostream> using namespace std; int main() { const char* a = "I am the data"; long long addr = (long long)(std::addressof(a)); cout << "address of a:" << addr << endl; const char* b = *(const char**)addr; cout << "b:" << b << endl; return 0; }
桂棹兮兰桨,击空明兮溯流光。