In the example below I don't understand why I get this error:
test.c:3:6: error: array type has incomplete element type
Here, the compiler should consider a complete type i.e. [2][3]
because each sub-element has a size of 3. So, where is the problem?
long foo[2][] = {
{2,3,4},
{5,6,7}
};
If I complete the type using foo[2][3]
I will get this error:
test.c:9:5: note: expected ‘long int *’ but argument is of type ‘long int (*)[3]’
int bar(long* list, size_t size)
Using this example:
int bar(long* list, size_t size);
int main() {
bar(&foo[0], sizeof(foo[0]));
return 0;
}
How can I fix it?