What's the point of requesting the memory if you're just going to free it up? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What's the point of requesting the memory if you're just going to free it up?

10th Apr 2018, 2:12 AM
Sir
3 Answers
+ 6
What's the point of ingesting food if you're just going to defecate? The point of dynamically requesting memory would of course be to use it to store data which size is known only at run time, in which after your program has executed, you free the memory because you no longer need it (and because programmers are responsible for garbage collection in C++).
10th Apr 2018, 2:33 AM
Hatsy Rei
Hatsy Rei - avatar
0
Simply put - You need 100 chairs for a wedding. Are you gonna buy 100 chairs or gonna hire a decorator for a day? Of course you don't need all those chairs after the wedding. So requesting memory is like hiring decorator when you need. It helps you to spend less money( in this case memory) and still get the job done. Have a good day sir.šŸ˜ƒ
10th Apr 2018, 2:53 AM
Akib
Akib - avatar
0
thanks, helpful explanation
10th Apr 2018, 3:07 AM
Sir