I looked at this SO post with no help.
int main()
{
int a[][] = {{1,2},{3,4}};
}
Error
$ gcc a.c
a.c:6:8: error: array has incomplete element type 'int []'
int a[][] = {{1,2},{3,4}};
^
1 error generated.
Why is a[][]
incomplete type?
Why is int a[][2]
fine?
I would've assumed that since compiler can initialize this 2-D array it can also figure out bounds automatically? I know that I'm required to provide size but why? Is it language requirement?