### 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 Referring to a Type with `__auto_type`). Thus, in some contexts C allows

- An `extern` declaration says how to refer to a variable allocated elsewhere. It does not need to allocate space for the variable, so if it is an array, you can omit the length. For example,

      extern int foo[];

- When declaring a function parameter as an array, the argument value passed to the function is really a pointer to the array’s zeroth element. This value does not say how long the array really is, there is no need to declare it. For example,

      int
      func (int foo[])

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. For example, suppose we want to represent the positions of pieces on a chessboard which has the usual 8 files (columns), but more (or fewer) ranks (rows) than the usual 8. This declaration could hold a pointer to a two-dimensional array that can hold that data. Each element of the array holds one row.

    struct chesspiece *funnyboard[][8];

Since it is just a pointer to the start of an array, its type can be incomplete, but it must state how big each array element is—the number of elements in each row.