The below code snippet works and compiles in C:
const int n=10;
int main(void)
{
int a[n];
return 0;
}
However, when the array is declared in global scope, it throws a compilation error.
const int n=10;
int a[n];
int main(void)
{
return 0;
}
Why doesn't it throw an error inside main?