This is the function in the class (the actual code is much longer so I just included sections). I want to be able to use the multiply code later in my main function in addition to this one instance.

double multiply(int N, double mat[][], double rix[][]) // This matrix multiplies two square matrices { int i, j, k, z ; double sum, product ; for (i=0; i<2; i++){ for (j=0; j<2; j++){ sum = 0; for (k=0; k<2; k++){ sum = sum + mat[i][k] * rix[z][j]; } *(product[i][j]) = sum; }} return product ; }

The main function is:

// ... double *kt_ptr, kt[2][2], ktt[2][2] ; *kt_ptr = &kt[][] ; double kt[2][2] = {{3, 5},{1, 9}}; double M[2][2] = {{1, 8},{4, 6}}; ktt = &multiply(2, M, kt); // ...