Subj : Re: Matrix Multiplication using pointers To : borland.public.cpp.borlandcpp From : "Beason Fordham" Date : Mon Jan 05 2004 01:33 am "Jeevan" wrote in message news:3ff1de01$1@newsgroups.borland.com... > Can anyone provide me with a code for matrix multiplication using the pointers.Please do help. > > Jeevan Here is a simple function for a multiplying 3X3 matrices (A * B = C) double A[3][3], B[3][3], C[3][3]; void MultiplyMatrices(double *A, double *B, double *C) { C[0] = A[0]*B[0] + A[1]*B[3] + A[2]*B[6]; C[1] = A[0]*B[1] + A[1]*B[4] + A[2]*B[7]; C[2] = A[0]*B[2] + A[1]*B[5] + A[2]*B[8]; C[3] = A[3]*B[0] + A[4]*B[3] + A[5]*B[6]; C[4] = A[3]*B[1] + A[4]*B[4] + A[5]*B[7]; C[5] = A[3]*B[2] + A[4]*B[5] + A[5]*B[8]; C[6] = A[6]*B[0] + A[7]*B[3] + A[8]*B[6]; C[7] = A[6]*B[1] + A[7]*B[4] + A[8]*B[7]; C[8] = A[6]*B[2] + A[7]*B[5] + A[8]*B[8]; } This is effectively passing pointers to the matrices. Hope it helps. Beason .