fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int x = 10;
  7. int* p = &x;
  8. cout << "x = " << x << endl;
  9. cout << "&x = " << &x << endl;
  10. cout << "p = " << p << endl;
  11. cout << "*p = " << *p << endl;
  12. *p = 50;
  13. cout << "After change:" << endl;
  14. cout << "x = " << x << endl;
  15. return 0;
  16. }
  17.  
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
x = 10
&x = 0x7fff68e36c84
p = 0x7fff68e36c84
*p = 10
After change:
x = 50