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



7 10 
15 22