It’s undefined behaviour, because it breaks a “shall” constraint:
C99 ยง6.7.5.2:
If the size is an expression that is
not an integer constant expression…
…each time it is evaluated it shall
have a value greater than zero.
More Related Contents:
- Passing a multidimensional variable length array to a function
- typedef fixed length array
- How does GCC implement variable-length arrays?
- String literals vs array of char when initializing a pointer
- What is the difference between C, C99, ANSI C and GNU C?
- Realistic usage of the C99 ‘restrict’ keyword?
- Which compiler should I trust?
- Does C99 guarantee that arrays are contiguous?
- Literal string initializer for a character array
- Create statically-linked binary that uses getaddrinfo?
- c99 goto past initialization
- Strange array initialize expression?
- What is the default C -std standard version for the current GCC (especially on Ubuntu)?
- Anonymous union within struct not in c99?
- Is there a GCC keyword to allow structure-reordering?
- Why can’t the size of a static array be made variable?
- Equivalents to MSVC’s _countof in other compilers?
- Printf long long int in C with GCC?
- Array of size 0 at the end of struct [duplicate]
- How to tell GCC that a pointer argument is always double-word-aligned?
- Explanation of output of this C code
- Finding target sum of two numbers in array
- What does dot (.) mean in a struct initializer?
- difference between %ms and %s scanf
- c structure array initializing
- Linking against older symbol version in a .so file
- What does -D_XOPEN_SOURCE do/mean?
- Can I make gcc tell me when a calculation results in NaN or inf at runtime?
- MinGW GCC: “Unknown conversion type character ‘h'” (snprintf)
- C array declaration and assignment?