fork(1) download
  1. #include <stdio.h>
  2.  
  3. int ans[2][2];
  4. void array_mul(int (*x)[2],int (*y)[2],int (*ans)[2])
  5. {
  6. for(int i=0;i<2;i++) //行
  7. {
  8. for(int j=0;j<2;j++) //列
  9. {
  10. int s,t;
  11. s = (x[i][0] * y[0][j]);
  12. t = (x[i][0] * y[1][j]);
  13. ans[i][j] = (s + t);
  14. }
  15. }
  16.  
  17. for(int k=0;k<2;k++)
  18. {
  19. for(int f=0;f<2;f++)
  20. {
  21. printf("%d\n",ans[k][f]);
  22. }
  23. }
  24. }
  25.  
  26. int main(void) {
  27. int x[2][2] = { {1,2},
  28. {3,4} };
  29. int y[2][2] = { {1,2},
  30. {3,4} };
  31. array_mul(x,y,ans);
  32. return 0;
  33. }
  34.  
Success #stdin #stdout 0.01s 5320KB
stdin
Standard input is empty
stdout
4
6
12
18