<s>
In	O
computer	B-General_Concept
programming	I-General_Concept
,	O
a	O
variable-length	B-Data_Structure
array	I-Data_Structure
(	O
VLA	O
)	O
,	O
also	O
called	O
variable-sized	O
or	O
runtime-sized	O
,	O
is	O
an	O
array	B-Data_Structure
data	I-Data_Structure
structure	I-Data_Structure
whose	O
length	O
is	O
determined	O
at	O
run	O
time	O
(	O
instead	O
of	O
at	O
compile	O
time	O
)	O
.	O
</s>
<s>
In	O
C	O
,	O
the	O
VLA	O
is	O
said	O
to	O
have	O
a	O
variably	B-Data_Structure
modified	I-Data_Structure
type	I-Data_Structure
that	O
depends	O
on	O
a	O
value	O
(	O
see	O
Dependent	O
type	O
)	O
.	O
</s>
<s>
Programming	O
languages	O
that	O
support	O
VLAs	O
include	O
Ada	B-Language
,	O
Algol	B-Language
68	I-Language
(	O
for	O
non-flexible	O
rows	O
)	O
,	O
APL	B-Language
,	O
C99	B-Language
(	O
although	O
subsequently	O
relegated	O
in	O
C11	O
to	O
a	O
conditional	O
feature	O
,	O
which	O
implementations	O
are	O
not	O
required	O
to	O
support	O
;	O
on	O
some	O
platforms	O
,	O
VLAs	O
could	O
be	O
implemented	O
previously	O
with	O
alloca( )	O
or	O
similar	O
functions	O
)	O
and	O
C#	B-Application
(	O
as	O
unsafe-mode	O
stack-allocated	O
arrays	O
)	O
,	O
COBOL	B-Application
,	O
Fortran	B-Application
90	I-Application
,	O
J	B-Language
,	O
and	O
Object	B-Language
Pascal	I-Language
(	O
the	O
language	O
used	O
in	O
Borland	B-Language
Delphi	I-Language
and	O
Lazarus	B-Language
,	O
that	O
uses	O
FPC	O
)	O
.	O
</s>
<s>
Growable	B-Data_Structure
arrays	I-Data_Structure
(	O
also	O
called	O
dynamic	B-Data_Structure
arrays	I-Data_Structure
)	O
are	O
generally	O
more	O
useful	O
than	O
VLAs	O
because	O
dynamic	B-Data_Structure
arrays	I-Data_Structure
can	O
do	O
everything	O
VLAs	O
can	O
do	O
,	O
and	O
also	O
support	O
growing	O
the	O
array	O
at	O
run-time	O
.	O
</s>
<s>
only	O
support	O
growable	B-Data_Structure
arrays	I-Data_Structure
.	O
</s>
<s>
Even	O
in	O
programming	O
languages	O
that	O
do	O
support	O
variable-length	B-Data_Structure
arrays	I-Data_Structure
,	O
it	O
's	O
often	O
recommended	O
to	O
avoid	O
using	O
(	O
stack-based	O
)	O
variable-length	B-Data_Structure
arrays	I-Data_Structure
,	O
and	O
instead	O
use	O
(	O
heap-based	O
)	O
dynamic	B-Data_Structure
arrays	I-Data_Structure
.	O
</s>
<s>
The	O
GNU	B-Application
C	I-Application
Compiler	I-Application
allocates	O
memory	O
for	O
VLAs	O
with	O
automatic	B-General_Concept
storage	I-General_Concept
duration	I-General_Concept
on	O
the	O
stack	O
.	O
</s>
<s>
The	O
following	O
C99	B-Language
function	O
allocates	O
a	O
variable-length	B-Data_Structure
array	I-Data_Structure
of	O
a	O
specified	O
size	O
,	O
fills	O
it	O
with	O
floating-point	O
values	O
,	O
and	O
then	O
passes	O
it	O
to	O
another	O
function	O
for	O
processing	O
.	O
</s>
<s>
Because	O
the	O
array	O
is	O
declared	O
as	O
an	O
automatic	B-General_Concept
variable	I-General_Concept
,	O
its	O
lifetime	O
ends	O
when	O
read_and_process( )	O
returns	O
.	O
</s>
<s>
In	O
C99	B-Language
,	O
the	O
length	O
parameter	O
must	O
come	O
before	O
the	O
variable-length	B-Data_Structure
array	I-Data_Structure
parameter	O
in	O
function	O
calls	O
.	O
</s>
<s>
Only	O
creation	O
of	O
VLA	O
objects	O
with	O
automatic	B-General_Concept
storage	I-General_Concept
duration	I-General_Concept
is	O
optional	O
.	O
</s>
<s>
GCC	B-Application
had	O
VLA	O
as	O
an	O
extension	O
before	O
C99	B-Language
,	O
one	O
that	O
also	O
extends	O
into	O
its	O
C++	O
dialect	O
.	O
</s>
<s>
With	O
the	O
Linux	B-Operating_System
4.20	O
kernel	B-Operating_System
,	O
the	O
Linux	B-Operating_System
kernel	I-Operating_System
is	O
effectively	O
VLA-free	O
.	O
</s>
<s>
The	O
following	O
is	O
the	O
same	O
example	O
in	O
Ada	B-Language
.	O
</s>
<s>
Ada	B-Language
arrays	O
carry	O
their	O
bounds	O
with	O
them	O
,	O
so	O
there	O
is	O
no	O
need	O
to	O
pass	O
the	O
length	O
to	O
the	O
Process	O
function	O
.	O
</s>
<s>
when	O
utilizing	O
the	O
Fortran	B-Application
90	I-Application
feature	O
of	O
checking	O
procedure	O
interfaces	O
at	O
compile	O
time	O
;	O
on	O
the	O
other	O
hand	O
,	O
if	O
the	O
functions	O
use	O
pre-Fortran	O
90	O
call	O
interface	O
,	O
the	O
(	O
external	O
)	O
functions	O
must	O
first	O
be	O
declared	O
,	O
and	O
the	O
array	O
length	O
must	O
be	O
explicitly	O
passed	O
as	O
an	O
argument	O
(	O
as	O
in	O
C	O
)	O
:	O
</s>
<s>
The	O
following	O
COBOL	B-Application
fragment	O
declares	O
a	O
variable-length	B-Data_Structure
array	I-Data_Structure
of	O
records	O
DEPT-PERSON	O
having	O
a	O
length	O
(	O
number	O
of	O
members	O
)	O
specified	O
by	O
the	O
value	O
of	O
PEOPLE-CNT	O
:	O
</s>
<s>
The	O
COBOL	B-Application
VLA	O
,	O
unlike	O
that	O
of	O
other	O
languages	O
mentioned	O
here	O
,	O
is	O
safe	O
because	O
COBOL	B-Application
requires	O
one	O
to	O
specify	O
the	O
maximal	O
array	O
size	O
–	O
in	O
this	O
example	O
,	O
DEPT-PERSON	O
cannot	O
have	O
more	O
than	O
20	O
items	O
,	O
regardless	O
of	O
the	O
value	O
of	O
PEOPLE-CNT	O
.	O
</s>
<s>
The	O
following	O
C#	B-Application
fragment	O
declares	O
a	O
variable-length	B-Data_Structure
array	I-Data_Structure
of	O
integers	O
.	O
</s>
<s>
Prior	O
to	O
C#	B-Application
version	O
7.2	O
,	O
a	O
pointer	O
to	O
the	O
array	O
is	O
required	O
,	O
requiring	O
an	O
"	O
unsafe	O
"	O
context	O
.	O
</s>
<s>
C#	B-Application
version	O
7.2	O
and	O
later	O
allow	O
the	O
array	O
to	O
be	O
allocated	O
without	O
the	O
"	O
unsafe	O
"	O
keyword	O
,	O
through	O
the	O
use	O
of	O
the	O
Span	O
feature	O
.	O
</s>
<s>
Object	B-Language
Pascal	I-Language
dynamic	B-Data_Structure
arrays	I-Data_Structure
are	O
allocated	O
on	O
the	O
heap	O
.	O
</s>
<s>
In	O
this	O
language	O
,	O
it	O
is	O
called	O
a	O
dynamic	B-Data_Structure
array	I-Data_Structure
.	O
</s>
<s>
Removing	O
the	O
contents	O
of	O
a	O
dynamic	B-Data_Structure
array	I-Data_Structure
is	O
done	O
by	O
assigning	O
it	O
a	O
size	O
of	O
zero	O
.	O
</s>
