fork download
  1. #include <stdio.h>
  2.  
  3. void array_mul(const int (*x)[2], const int (*y)[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. array_mul(x, y);
  12.  
  13. return 0;
  14. }
  15.  
  16. void array_mul(const int (*x)[2], const int (*y)[2])
  17. {
  18. printf("multiplication\n");
  19.  
  20. for (int i = 0; i < 2; i++) {
  21. for (int j = 0; j < 2; j++) {
  22.  
  23. int sum = 0;
  24. for (int k = 0; k < 2; k++) {
  25. sum += x[i][k] * y[k][j];
  26. }
  27.  
  28. printf("%d ", sum);
  29. }
  30. }
  31. }
Success #stdin #stdout 0s 5288KB
stdin
Standard input is empty
stdout
multiplication
7 10 15 22