fork download
  1. #include <cstdio>
  2. #include <cstdlib>
  3.  
  4. int main(void) {
  5. int n = 1000, m = 10000;
  6. int * p = new int[n];
  7. for (int i = 0; i < n; i++) p[i] = rand();
  8.  
  9. int * y;
  10. y = new int[n + m];
  11. for(int i = 0; i < n;i++) {y[i] = p[i];}
  12. delete [] p;
  13. p = y;
  14.  
  15. for (int i = 0; i < m; i++) p[n + i] = rand();
  16. printf("%d\n", p[n + m - 1]);
  17. delete [] p;
  18. return 0;
  19. }
  20.  
Success #stdin #stdout 0s 3456KB
stdin
Standard input is empty
stdout
1398104335