The error: array type has  incomplete element type means you have not mentioned the second column dimension of a multidimensional array

Let’s see the concept

Initializing a 2D array

It is a rule in C to mention the second (column) dimension of a multidimensional array whereas the  first dimension (row) is optional

The following declaration of a 2D array is acceptable

``````int arr[4][3]={{1,2,3},{2,3,4},{3,4,5},{4,5,6}};
int arr[ ][3]={{1,2,3},{2,3,4},{3,4,5},{4,5,6}};``````

But, without a second (column) dimension it is illegal and causes an error

``````int arr[4][ ]={{1,2,3},{2,3,4},{3,4,5},{4,5,6}};
int arr[ ][ ]={{1,2,3},{2,3,4},{3,4,5},{4,5,6}};``````

Furthermore, for 3D arrays [ no of blocks of 2d array] is optional

``````int arr[3][4][2] = {
{ {2, 4}, {7, 8}, {3, 4}, {5, 6} },
{ {7, 6}, {3, 4}, {5, 3}, {2, 3} },
{ {8, 9}, {7, 2}, {3, 4}, {5, 1} }
};
int arr[ ][4][2] = {
{ {2, 4}, {7, 8}, {3, 4}, {5, 6} },
{ {7, 6}, {3, 4}, {5, 3}, {2, 3} },
{ {8, 9}, {7, 2}, {3, 4}, {5, 1} }
};``````

But, for a 3D array without  a first dimension (row) and a second (column) dimension, it is illegal and causes an error

``````int arr[3][ ][2] = {
{ {2, 4}, {7, 8}, {3, 4}, {5, 6} },
{ {7, 6}, {3, 4}, {5, 3}, {2, 3} },
{ {8, 9}, {7, 2}, {3, 4}, {5, 1} }
};
int arr[3][4][ ] = {
{ {2, 4}, {7, 8}, {3, 4}, {5, 6} },
{ {7, 6}, {3, 4}, {5, 3}, {2, 3} },
{ {8, 9}, {7, 2}, {3, 4}, {5, 1} }
};
int arr[3][ ][ ] = {
{ {2, 4}, {7, 8}, {3, 4}, {5, 6} },
{ {7, 6}, {3, 4}, {5, 3}, {2, 3} },
{ {8, 9}, {7, 2}, {3, 4}, {5, 1} }
};
int arr[ ][ ][ ] = {
{ {2, 4}, {7, 8}, {3, 4}, {5, 6} },
{ {7, 6}, {3, 4}, {5, 3}, {2, 3} },
{ {8, 9}, {7, 2}, {3, 4}, {5, 1} }
};``````

### Mohammed Anees

Hey there, welcome to aneescraftsmanship I am Mohammed Anees an independent developer/blogger. I like to share and discuss the craft with others plus the things which I have learned because I believe that through discussion and sharing a new world opens up