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