int det1(int b[][], int n); 

This is showing error something like this

determinant.c:4:15: error: array has incomplete element type 'int []'
int det1(int b[][], int n);

1 Answer 1


You have declared a two-dimensional array without specifying dimensions.

The kind of two-dimensional array you'd declare with a simple

int matrix[3][3] = {{1, 0, 0}, {0, 0, 1}, {0, -1, 0}};

is actually a 1-dimensional array (compiler will fake a few things), so for mapping it to the right elements, the compiler needs to know the dimensions first (all but the first).

If n is the dimension of a square matrix, you could have a function like

int det1(int n, int b[][n]);

as n comes before int b[][n] it can be used to provide that dimension. If your matrix dimension in memory is actually a constant potentially larger than the matrix dimension as used (and you don't intend to ever handle larger matrices), you'd use that one instead. The compiler must be told how to map the elements of the array to the different rows, that's all.

There's also another kind of two-dimensional array, which is an array containing pointers for example to arrays of int, that one would be of type int **, and needs to be handled a bit differently (expecially creation/destruction is not as convenient).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .