+ 2

What is dynamic memory?

5th Sep 2016, 6:47 AM
ANUJ CHITMITWAR
ANUJ CHITMITWAR - avatar
5 ответов
+ 8
Memory needs are usually determined before program execution, but there are cases where they can only be determined at runtime. There are also cases where you want the memory allocation to persist across multiple function calls. On these cases, programs need to dynamically allocate memory, which in C++ is done with the operators new and delete. Dynamic memory allocation is done on the heap (rather than the stack like static memory allocation). Don't forget to properly delete anything you created dynamically, or you will end up clogging the ram little by little with each execution of your program until you reboot (this is called a memory leak).
5th Sep 2016, 9:42 AM
Zen
Zen - avatar
+ 1
Thanks zen
5th Sep 2016, 8:18 PM
ANUJ CHITMITWAR
ANUJ CHITMITWAR - avatar
+ 1
in short... memory area allocated at run time are dynamic memory......
11th Sep 2016, 5:50 PM
Rishi Thakur
Rishi Thakur - avatar
+ 1
if the array size is not fix then we can use dynamic memory. using new operatpr
13th Sep 2016, 2:03 PM
Twinkle Baisane
Twinkle Baisane - avatar
0
@zen should the delete function be called at the end of every program to clr the dynamic memory n is it a function i.e. delete
12th Sep 2016, 11:37 AM
Umed Jadhav
Umed Jadhav - avatar