fork download
  1. #include <iostream>
  2. using namespace std; // consider removing this line in serious projects
  3.  
  4. int main() {
  5. int *a = new int[5];
  6. a[0] = 2;
  7. a[1] = 6;
  8. a[2] = 9;
  9. a[3] = 1;
  10. a[4] = -2;
  11. int *b = a;
  12. cout << &a << endl;
  13. for (int i = 0; i < 5; i++) {
  14. cout << &a[i] << endl;
  15. }
  16. for (int i = 0; i < 5; i++) {
  17. cout << b[i] << endl;
  18. }
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25. return 0;
  26. }
Success #stdin #stdout 0.01s 5288KB
stdin
1
2
10
42
11
stdout
0x7ffe08f11870
0x55b11a4dee70
0x55b11a4dee74
0x55b11a4dee78
0x55b11a4dee7c
0x55b11a4dee80
2
6
9
1
-2