I just read the entire search result on the same topic that I am asking right now in stackoverflow, and in fact this does not meet my curiosity. But here is what.
Question
1.) From what I know, static binding means that it is set at compile time, and it is at run time, whereas for dynamic binding it is set at run time.
2.) So, the book I read represents a dynamic array, it mentions that the size of the dynamic array can be set at runtime. This is done in this way.
Code
int size; cin >> size; int * pz = new int [size];
3.) In this code, the book mentions the dynamic size of the array, which can be set at runtime. So out of curiosity I try this.
Code
int size; cin >> size; int array[size];
4.) The code above also works, so I'm just wondering what is so special about a dynamic array, since a regular static array could do the same job.
5.) Is it because the dynamic array can free its memory at runtime, while the static cannot do something special?
Thank you for taking the time to read my question, pay attention to any mistake made by me.
source share