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