- Variable-length array
In programming, a
variable length array (or VLA) is anarray data structure of automatic storage duration whose length is determined at run time (instead of at compile time).Programming languages that support VLAs include APL,
COBOL , and C (added inC99 ).Examples
The following C function allocates a variable-length array of a specified size, fills it with floating-point values, then passes it to another function for processing. Because the array is declared as an automatic variable, its lifetime ends when the
read_and_process
function returns.The following
COBOL fragment declares a variable-length array of records.Languages such as C# and Java do not have variable-length arrays, because all arrays in those languages are dynamically allocated on the heap and therefore do not have automatic storage duration.
Wikimedia Foundation. 2010.