Allocating/Freeing memory the right way | SoloLearn: Learn to code for FREE!

+1

Allocating/Freeing memory the right way

Am I making good use of these memory allocation/freeing in my code? What practices can you recommend with dealing with dynamic memory stuff? Also critique my code please https://code.sololearn.com/cO26g6EB47ma/?ref=app

12/31/2019 6:41:01 AM

0x6176696c61

1 Answer

New Answer

0

It's a good code,but don't use dynamic memory allocation all time,there are functions that deal with pointers in stack memory,use dynamic memory allocation when necessary,in your case is ok,because if you create a pointer in a function and return it,it's not a garantee that the memory block of the pointer will not be used by the compiler, Check the <string.h> functions. Sorry for my bad english ;_;