when trying to initialize a multidimensional array like this:
int a[][] = { {1,2,3}, {4,5,6} }; I get this error:
error: declaration of iArray as multidimensional array must have bounds for all dimensions except the first but I want to understand why, the compiler should know it's a[2][3] array because of the {}.
I know that is allowed also to do:
int a[][3] = {1,2,3,4,5,6}; and for that case indeed the compiler can't guess what is the 2nd dimension if it missing, but why not to allow the use of a[][] in the first case?
int a[5] = { 1,2,3};you are allowed to omit values in the end. Thats the only reason I could imagine. However,int a[] = {1,2,3};is allowed. So maybe there is no technical reason, but it just this way because it is this way