Doubt in memory allocation

When we do:


int n; cin>>n;

int a[n];

I read somewhere it is static memory allocation. But how? Isn’t n taken input at runtime. How does compiler decide what amount of memory is to be allocted in symbol table to array a?

hi @harshsharmajnv_9b70d236614796d5,
It is actually static memory allocation (since they are kept in stack memory) this depends on the place from where the memory is being allocated

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.