#include <iostream> #include <string> using namespace std; int main() { string food = "Pizza"; string* ptr = &food; cout << ptr << "\n"; // the address cout << *ptr; // the value at that address return 0; } // Output: // 0x61ff08 (varies) // Pizza
Click Run to execute this code.