I have some problems with function when using arrays,
I have problem to claculate two matrix multiplication by using three functions
function1:-getting values from keyboard
does any can have idea to do that
you pass a pointer of the matrix array to function1 and let it input the numbers.
you pass two pointer of the matrices you want to mult to function2, and a third pointer as the result matrix.
you again pass the pointer of the multiplied matrix to function3 to print it.
I have poor knowledge about pointers can little bit explain the answer?
Sorry, but i'm no expert. You'd better read the site tutorials before going on.
In general, you have M1, an s-by-r matrix and M2 a, t-by-u matrix. The operation is defined if and only if r=t. (Definition of matrix multiplication). The dimension of the result is s-by-u. Finally, each element is an inner product of rows of M1 and columns of M2. You want a triple nested for loop of some kind:
I can't guarantee that's what you want, but that's pretty damn close. Hopefully the rest of the forum won't skin me alive.
for(int i = 0; i < s; i++)
for(int j = 0; i < u; j++)
result[i][j] = 0;
for(int k = 0; k < r; k++)
result[i][j] += m1[i][k] * m2[k][j];