How and when do i use malloc? | SoloLearn: Learn to code for FREE!

+1

How and when do i use malloc?

I understand the concept behind malloc but i dont understand when to use it

5/15/2020 6:17:58 PM

Guido Parlatore

1 Answer

New Answer

+3

generally when you need to handle dynamic data that the size is not known during coding and compilation. e.g. with records we don't know how many a user will input hence it being dynamic else when you need to allocate a few memory spaces which C usually does for you anyway (if you know assembly then this will make more sense)