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