|55|error: incompatible type for argument 1 of 'det'
#include <stdio.h> #if !defined(N) #define N 3 #endif double det(double A[N][N], int dim); int main(void) { int dim, j, k; double A[N][N], det_value; dim = N; printf("Matrix A is\n"); for (j = 0; j < N; j++) { for (k = 0; k < N; k++) { printf(" %g", A[j][k]); } printf("\n"); } det_value = det(A[N][N], dim); printf("det(A) = %g\n", det_value); return 0; } double det(double A[N][N], int dim) { int i, a, b; double ce, temp, value, sum_value; if (dim == 2) { return A[0][0] * A[1][1] - A[0][1] * A[1][0]; } else { ce = 1; for (i = 0; i < dim; i++){ for (a = 0; a < dim; a++) { if (a != i) { for (b = 1; b < dim; b++) { if (a < i) { temp = A[i][0]; A[a][b] = A[a + 1][b]; value = ce * temp * det(A[N-1][N-1], dim - 1); sum_value += value; ce *= (-1); } else if (a > i) { temp = A[i][0]; A[a][b] = A[a + 1][b + 1]; dim--; value = ce * temp * det(A[N-1][N-1], dim - 1); sum_value += value; ce *= (-1); } } } } } return sum_value; } } /* I'm doing a calculation of a matrix, and I have no idea why it is keep showing the "incompatible type error" messeges. Can anyone help me figure it out ? I will be appreciated. */