+ 3
As you know your c++ program is first compiled by a compiler. During that compilation the compiler allocates memory for each and every variable you have defined. But take a case where you want to take input from user where he would enter the size of array according to his needs, in that case we use dynamic memory allocation because the program is compiled and gone to running state. It is known as dynamic memory allocation. Hope it helps....
7th Jan 2018, 4:24 PM
Rishabh Agrawal
Rishabh Agrawal - avatar