Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Traditionally C arrays are declared with an index that is either a fixed constant or empty. An array with a fixed constant index indicates to the compiler how much space to reserve for the array. An array declaration with an empty index is an incomplete type, and indicates that the variable references a pointer to an array of indeterminate size.

The term conformant array parameter comes from Pascal; it refers to a function argument that is an array whose size is specified in the function declaration.  Since C99, C has permitted array supported conformant array parameters by permitting array parameter declarations to use extended syntax. The most well-known extension is for variable-length arrays (VLAs). In this case, the array index is a variable, and the size of the array is determined at run-time, rather than compile-time. Section 6.7.6.1, paragraph 1, summarizes the array index syntax extensions:

... the [ and ] may delimit an expression or *. If they delimit an expression (which specifies the size of an array), the  expression shall have an integer type. If the expression is a constant expression, it shall  have a value greater than zero.

...