VOOZH about

URL: https://www.geeksforgeeks.org/c/g-fact-92/

⇱ Initialization of variables sized arrays in C - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Initialization of variables sized arrays in C

Last Updated : 23 Jul, 2025
The C99 standard allows variable sized arrays (see this). But, unlike the normal arrays, variable sized arrays cannot be initialized. For example, the following program compiles and runs fine on a C99 compatible compiler. Output:
0 0
0 0
But the following fails with compilation error.
Output:
Compiler Error: variable-sized object may not be initialized
Comment
Article Tags: