GCC compiles the following function
void f(int i)
{
int a[i];
}
I was under the impression that you can only initialize arrays with constant length. Is this supposed to compile, and will it do what I expect it to?
GCC compiles the following function
void f(int i)
{
int a[i];
}
I was under the impression that you can only initialize arrays with constant length. Is this supposed to compile, and will it do what I expect it to?
C99 added variable length arrays. And gcc
adds this to c89 as an extension with -std=gnu89
option (the default with gcc
).
In the latest C Standard, C11, variable length arrays support is marked as optional.
VLA's are allowed in C99. GCC extention allows it to compile in C89 mode.