2D array as function parameter
Hi
I was trying to calculate the determinant of a 2X2 matrix. but the problem is passing in a 2D array. I know you need to give number of columns but in that it only declares 1D array. Follwing should make more sense.
Code:
double det(double M[][5],int i,int j)
{
double det = 0;
if(i == j == 2)
{
det = M[i-2][j-2] * M[i-1][j-1] - M[i-1][j-2] * M[i-2][j-1];
return det;
}
}
I am calling this function by:
Code:
calcdet = det(Matrix,2,2);
where Matrix is 2D array with values.
Any help would be really appreciated.