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