fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. // your code goes here
  6.  
  7. int *p = nullptr;
  8. int *q = nullptr;
  9.  
  10. {
  11. int array[] {1, 2, 3, 5, 10};
  12. p = array + 2; // &array[2]
  13. q = array + 4; // &array[4]
  14.  
  15. cout << "p = " << *p << endl;
  16. cout << "q = " << *q << endl;
  17. }
  18.  
  19. cout << "p = " << *p << endl;
  20. cout << "q = " << *q << endl;
  21.  
  22. return 0;
  23. }
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
p = 3
q = 10
p = 0
q = -1218547724