Variable-length array
A variable-length array is an array whose bound is determined at run time rather than fixed as a compile-time constant.
Modern C, Third Edition
A variable-length array is a C array whose bound is determined at run time rather than being an integer constant expression.
- How it is used
- Explains run-time-sized arrays through declaration constraints, lifetime rules, portability, and storage-exhaustion risks.
- How deep it goes
- Descends from classification to initialization, scope, lifetime, and stack behavior, but does not develop a complete implementation example.
- Examples
- Uses array-length classification, initializer-based fixed arrays, a control-flow lifetime example, and stack-exhaustion scenarios.
- What you can do after
- Evaluate VLA declarations for validity, lifetime behavior, portability, and potential stack exhaustion.
Read how Modern C, Third Edition explains variable-length array →
Modern C
A variable-length array is a C array whose length is determined at run time and whose lifetime rules differ from those of ordinary automatic objects.
- How it is used
- Distinguishes run-time-sized arrays from fixed-length arrays and establishes their declaration and lifetime restrictions.
- How deep it goes
- Defines classification, restrictions, length calculation, and lifetime, but defers broader storage details.
- Examples
- Uses initializer-sized arrays, a sizeof-based length formula, and a control-flow example contrasting VLA and non-VLA lifetime.
- What you can do after
- Apply C declaration rules to classify arrays, calculate array length, and reason about when VLA storage is valid.
Related concepts
- lifetimecontrasts with · A lifetime is the interval during which a program entity exists and remains valid or accessible under the applicable language rules.
- arraykind of · An array is an indexed, ordered collection of elements arranged in one or more dimensions, with elements accessed by position.
- initializercontrasts with · An initializer is a function, declaration, or language construct that establishes the initial value or state of an object, value, computation, or process.
- gotocontrasts with · A goto statement or instruction unconditionally transfers program execution to a labeled statement or location within the current execution unit.
- C99configured by · C99 is the ISO standard revision of the C programming language published in 1999.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

