fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main() {
  4. int *arr = new int[15];
  5.  
  6. for (int i = 0; i < 5; i++)
  7. arr[i] = 2 * i;
  8.  
  9. for (int i = 0; i < 5; i++)
  10. cout << arr[i] << " ";
  11. cout << endl;
  12.  
  13. delete[] arr;
  14. arr = NULL;
  15.  
  16. for (int i = 0; i < 5; i++)
  17. arr[i] = 3 * i + 1;
  18.  
  19. for (int i = 0; i < 5; i++)
  20. cout << arr[i] << " ";
  21. cout << endl;
  22.  
  23. return 0;
  24. }
Runtime error #stdin #stdout 0s 15232KB
stdin
0 2 4 6 8

1 4 7 10 13
stdout
0 2 4 6 8