fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.  
  6. int x = 10;
  7. cout << "x = " << x << endl;
  8. cout << "&x = " << &x << endl;
  9. int* ptr = &x;
  10. cout << "ptr = " << ptr << endl;
  11. cout << "&ptr = " << &ptr << endl;
  12. *ptr = 100;
  13. cout << "x = " << x << endl;
  14.  
  15. return 0;
  16. }
Success #stdin #stdout 0.01s 5536KB
stdin
Standard input is empty
stdout
x = 10
&x = 0x7ffe02dc10ac
ptr = 0x7ffe02dc10ac
&ptr = 0x7ffe02dc10b0
x = 100