Dynamic allocation

if we declare an array like :
int n;
cin>>n;
int a[n];
then this would be dynamically allocated or statically?
and if:
int *p=new int[10];
since the size is known at compile time will it be static allocation?

@pradhumangupta99
a[n] is dynamically allocated. new int[10] is static allocation.
when you do new int[10] , this memory is initialised in heap memory and a[n] is initialised in stack memory.

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.