When you declare a local variable, its size is known at compile time, but memory allocation occurs at runtime.
So, in your examples, an array without size is clearly a problem for the compiler, because it does not know what size should be included in the assembler code.
If you do not know the size of the array, you can always use pointer types and malloc / free or even alloca . The first two work on the heap, and alloca actually uses the stack.
A notable exception is static variables. The storage for them is distributed by compilation / link time and cannot be changed at runtime.
Examples:
int main(int argc, const char *argv[]) { int a;
source share