fork download
  1. #include <stdio.h>
  2.  
  3. void calculate(int (*a)[4]){
  4.  
  5. const int ROWS = 3;
  6. const int COLS = 4;
  7.  
  8.  
  9. int sum[ROWS];
  10.  
  11. for (int i = 0; i < ROWS; i++){
  12. sum[i] = 0;
  13. for (int j = 0; j < COLS; j++){
  14. sum[i] += a[i][j];
  15. }
  16. printf(" %d\n",sum[i]);
  17. }
  18. }
  19.  
  20. int main() {
  21.  
  22. int array_a[3][4]={
  23. {1, 2, 3, 4},
  24. {5, 6, 7, 8},
  25. {9, 10, 11, 12}
  26. };
  27.  
  28.  
  29. calculate(array_a);
  30.  
  31. return 0;
  32. }
Success #stdin #stdout 0.01s 5280KB
stdin
Standard input is empty
stdout
 10
 26
 42