What happens if you didn't delete the allocated memory inside a method ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What happens if you didn't delete the allocated memory inside a method ?

There is a trouble where if I delete the allocated memory it will result a strange behavior, while if I didn't it will work well but with a memory leak as I know. https://code.sololearn.com/cIwaLhplysTV/?ref=app

20th Apr 2022, 3:11 PM
Mohammed
2 Answers
+ 1
Mohammed, May I suggest you to use a vector for data container instead of using arrays? it will be much easier cause we don't need to worry about house cleaning. This is an example that shows why manual memory management can be a tedious thing to do ...
20th Apr 2022, 4:11 PM
Ipang
20th Apr 2022, 10:23 PM
William Owens
William Owens - avatar