I’m attempting to solve a matrix multiplication problem with C. Lattice sizes given in issue (2x2) I composed this code yet it doesn’t print result as I anticipate. I believe I’m feeling the loss of a point about the rules of C.
What is my misstep in this code?
#include <stdio.h>
int main() {
int matA[2][2]={0,1,2,3};
int matB[2][2]={0,1,2,3};
int matC[2][2];
int i, j, k;
for (i = 0; i < 2; i++) {
for(j = 0; j < 2; j++) {
for(k = 0; k < 2; k++) {
matC[i][j] += matA[i][k] * matB[k][j];
}
printf("%d\n",matC[i][j]);
}
}
}