fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int m = 5, n = 7 ;
  6. int *p ;
  7.  
  8. p = &n ;
  9. *p = 2 * n + m ;
  10. *p = 2 * n + m ;
  11.  
  12. p = &m ;
  13. *p = 2 * m + n ;
  14. *p = 2 * m + n ;
  15.  
  16. cout << "m = " << m << ", " ;
  17. cout << "n = " << n << ", " ;
  18. cout << "*p = " << *p << endl ;
  19.  
  20. int arr[5] = {1, 2, 3, 4, 5};
  21. int *ptr = arr;
  22. cout << *(ptr + 2) << endl;
  23.  
  24. cout << &arr[5] << endl;
  25.  
  26. return 0;
  27. }
Success #stdin #stdout 0s 15232KB
stdin
Standard input is empty
stdout
m = 149, n = 43, *p = 149
3
0x7ffeb135ec74