Jump to: navigation, search


The concept of a variable-length array (VLA) was introduced in the 1999 revision of the C standard, C99. VLAs involve several changes to the language syntax to facilitate passing them to functions.

Any array whose number of elements is not a constant, will be implemented as a VLA by a C99 compiler.


#define a 1
int b = 1;
const int c = 1;

double foo[a];  /* normal fixed-length array */
double bar[b];  /* variable-length array */
double baz[c];  /* variable-length array */

As you can see in this example, in C the keyword const does not make an expression into a compile-time constant.

Personal tools