What is the practical purpose of dynamic memory allocation either in c or cpp? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is the practical purpose of dynamic memory allocation either in c or cpp?

I have just learnt about dynamic memory allocation, After seeing a lot of videos and reading many examples, I understood what it is. But now,how and where to use excatly?

25th Mar 2019, 5:28 PM
Vikranth Paluri
Vikranth Paluri - avatar
3 Answers
+ 9
Dynamic memory allocation is mainly used while working with pointers. If you declare a pointer, but you don't want it to point at other variable, then you can use dynamic memory allocation to use that pointer.
25th Mar 2019, 5:37 PM
Letsintegreat
Letsintegreat - avatar
+ 6
Vikranth Paluri Pleased to help you😊
25th Mar 2019, 5:54 PM
Letsintegreat
Letsintegreat - avatar
+ 1
Got it! Thanks bro✌🏻✌🏻
25th Mar 2019, 5:52 PM
Vikranth Paluri
Vikranth Paluri - avatar