When is memory allocated to local variables in C
问题 As local variables are also called automatic variables, and are supposed to be allocated memory at run time, when function is accessed. int main(){ int a; // declaration return 0; } int main(){ int a[]; // compilation error, array_size missing return 0; } int main(){ int a[2]; // declaration, but can't work without array_size, // so at compile time it is checked! return 0; } My question is whether it's just a rule to give array_size in declaration in C, or memory is allocated at compile time