在C/C++中,可以使用“&”操作符来获取一个变量的地址。示例如下:
int x = 10; int* ptr = &x; cout << "Address of x: " << ptr << endl;
输出结果为:
Address of x: 0x7ffeedf893c4
上一篇:变量的定义是什么?
下一篇:变量的地址被传值,而非它的实际值。