fork download
  1. #include <stdio.h>
  2.  
  3.  
  4. #define SIZE 2
  5.  
  6.  
  7. void array_mul(int (*x)[SIZE], int (*y)[SIZE], int (*ans)[SIZE]){
  8.  
  9.  
  10. for (int i=0;i<SIZE;i++){
  11.  
  12. for (int j=0;j<SIZE;j++){
  13.  
  14. ans[i][j] = 0;
  15.  
  16. for (int k = 0; k < SIZE; k++){
  17. ans[i][j]+=x[i][k]*y[k][j];
  18. }
  19. }
  20. }
  21.  
  22.  
  23.  
  24. for (int i = 0; i < SIZE; i++) {
  25. for (int j = 0; j < SIZE; j++) {
  26. printf("%d ", ans[i][j]);
  27. }
  28. printf("\n");
  29. }
  30. }
  31.  
  32. int main() {
  33.  
  34. int array_x[SIZE][SIZE] = {
  35. {1, 2},
  36. {3, 4}
  37. };
  38.  
  39. int array_y[SIZE][SIZE]={
  40. {1, 2},
  41. {3, 4}
  42. };
  43.  
  44.  
  45. int array_ans[SIZE][SIZE];
  46.  
  47. array_mul(array_x, array_y, array_ans);
  48.  
  49.  
  50. return 0;
  51. }
  52.  
Success #stdin #stdout 0.01s 5288KB
stdin
Standard input is empty
stdout
7 10 
15 22