Friday, July 31, 2009

How to find the product of 2d array matrices in c?

Is this a homework assignment?





MultMatrix(firstM, secondM, outM, firstrows, cols, secondcols)


Matrix firstM, secondM, outM;


int firstrows, cols, secondcols;


{


int i,j,k;


double sum;





for(i=0; i %26lt; secondcols; i++)


for(j=0; j %26lt; firstrows; j++)


{


sum = 0.0;


for(k=0; k %26lt; cols; k++)


sum += firstM[j][k] * secondM[k][i];


outM[j][i] = sum;


}


}


No comments:

Post a Comment