when your program loads and runs, it occupies a certain amount of memory, for instructions, data storage, etc. As it runs, it may need additional memory space to store more data, or load new instructions.
So, one of the system subroutines is a call to malloc or some equivalent function, which contacts the operating system and requests a new chunk of memory for program use.
This is dynamic allocation, as opposed to the static amount allocated when the program started.
It's not unique to C++. Any modern programming language has some way to grab more memory as it is needed.
Explain the term "dynamic memory allocation" in C++?
Please explain it in such a way i will understand it
2 answers
Thank you so much