Hi everyone! I am new to C++ and I am required to do an assignment about matrix multiplitation.
My function doing the multiplitation is as follow:
1 2 3 4 5 6 7 8
int maniplitation( int A[][100], int B[][100], int C[][100], int c, int d) {
for ( int i = 0 ,j = 0; i < c, j < d ; i++, j++) {
for ( int s = 1 ; s <= c ; s++) {
int temp = A[i][s-1] * B[s-1][j];
C[i][j] += temp;
}
return C[c][d];}
}
Where A and B are two separate 2D arrays containing the two matrix, C is the new array formed, c is the number of columns of array A while d is the number of rows of array B. Each matrix would have a maximum of 100 rows or columns.
However, when I print out c, it contains garbage value like -858993433. Would anyone tell me how to solve it? Thank you very much.