运行 ❯
获取您
自己的
网站
×
更改方向
更改主题,深/浅
前往 Spaces
#include <iostream> #include <string> using namespace std; int main() { string food = "Pizza"; // A string variable string* ptr = &food; // A pointer variable that stores the address of food // Output the value of food cout << food << "\n"; // Output the memory address of food cout << &food << "\n"; // Output the memory address of food with the pointer cout << ptr << "\n"; return 0; }
披萨
0x6dfed4
0x6dfed4