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.
0 0 0 0
But the following fails with compilation error.
Compiler Error: variable-sized object may not be initialized
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
- What's difference between char s and char *s in C?
- Data Types in C
- Variable Length Arrays in C and C++
- Arrays in C Language | Set 2 (Properties)
- Arrays in C/C++
- What are the data types for which it is not possible to create an array?
- How to dynamically allocate a 2D array in C?
- Difference between pointer and array in C?
- Scansets in C
- Complicated declarations in C
- Are array members deeply copied?
- What is the difference between single quoted and double quoted declaration of char array?
- Initialization of a multidimensional arrays in C/C++
- Write one line functions for strcat() and strcmp()
- Do not use sizeof for array parameters