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. for(int m=0;m<2;m++)
  11. {
  12. int s,t;
  13. s = (x[i][0] * y[0][m]);
  14. t = (x[i][0] * y[i][1]);
  15. ans[i][j] = (s + t);
  16. }
  17. }
  18. }
  19.  
  20. for(int k=0;k<2;k++)
  21. {
  22. for(int f=0;f<2;f++)
  23. {
  24. printf("%d\n",ans[k][f]);
  25. }
  26. }
  27. }
  28.  
  29. int main(void) {
  30. int x[2][2] = { {1,2},
  31. {3,4} };
  32. int y[2][2] = { {1,2},
  33. {3,4} };
  34. array_mul(x,y,ans);
  35. return 0;
  36. }
  37.  
Success #stdin #stdout 0.01s 5272KB
stdin
Standard input is empty
stdout
4
4
18
18