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