Next: , Previous: , Up: Arrays   [Contents][Index]

16.5 Incomplete Array Types

An array is equivalent, for most purposes, to a pointer to its zeroth element. When that is true, the length of the array is irrelevant. The length needs to be known only for allocating space for the array, or for sizeof and typeof (see Auto Type). Thus, in some contexts C allows

These declarations are examples of incomplete array types, types that are not fully specified. The incompleteness makes no difference for accessing elements of the array, but it matters for some other things. For instance, sizeof is not allowed on an incomplete type.

With multidimensional arrays, only the first dimension can be omitted:

extern struct chesspiece *funnyboard foo[][8];

In other words, the code doesn’t have to say how many rows there are, but it must state how big each row is.