How do I define variable of type int[][26]?
int[][26]
is an array of unknown bound. You cannot define variables of such type.
Arrays of unknown bound can are typically used in contexts where the type is adjusted to be something else. For example, in a function argument list, an array is adjusted to be a pointer to an element of such array. The following are equivalent due to type adjustment:
void A(int abc[][26]);
void A(int (*abc)[26]);
// adjusted argument type is int(*)[26]
Another example of such adjustment is definition of a variable, where the bound is deduced from the initialiser. The following are equivalent due to type adjustment:
int arr[][26] = {{}, {}};
int arr[2][26] = {};
// adjusted array type is int[2][26]
A use case for arrays of unknown bound where the type is not adjusted is in templates, where explicitly providing such array as template type argument can be used to signify that a pointer is to an element in an array, rather than a singular object. For example, std::allocator<int>::deallocate
will invoke delete
while std::allocator<int[]>::deallocate
will invoke delete[]
.