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


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

12/31/2019 6:41:01 AM


1 Answer

New Answer


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 ;_;