fork download
  1. #ifndef POINTER04_H_
  2. #define POINTER04_H_
  3.  
  4. #include <cstdio>
  5. #include <cstdlib>
  6. #include <cstring>
  7. #include <cassert>
  8.  
  9. void array_reverse (int *head, int *tail);
  10.  
  11. int main ()
  12. {
  13. int n;
  14. scanf("%d", &n);
  15.  
  16. int *arr = (int *) malloc(sizeof(int[n]));
  17. for (int i = 0; i < n; i++)
  18. {
  19. scanf("%d", &arr[i]);
  20. }
  21.  
  22. array_reverse(arr, arr + n - 1);
  23.  
  24. for (int i = 0; i < n; i++)
  25. {
  26. printf("%d%c", arr[i], " \n"[i == n - 1]);
  27. }
  28. }
  29. #endif // POINTER04_H_
  30.  
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty