I am new at programming, so it might be so that I am not able to understand this properly, but from what I know, static array is an array which has it's memory defined during the compile time, and it's coding semantics are something like,
int a[5];
and a dynamic array is one in which the memory is defined during the compile time and it's coding semantics would go something like
int* b=new int[5];
Now they say that the dynamic array has it's memory defined at run time. But I have provided all the information needed by the compiler to create my array b, then why will it wait for run time to create it's memory.
Secondly whenever I'm writing in my code
cin>>n;
int a=[n]
then it is still compiling. But as we know that the compiler needs information on what is the array size for a static array, then how is this code getting compiled if I have not provided it with the information on what the array size is. If it needs to define the memory space for that array during compile time then it needs its information of array size.
Please try and explain what a dynamic array is properly, what are it's coding declarations, and the same for static array.