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