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