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