Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2
Yes. Malloc returns a null pointer if memory isn't allocated. So check like this : if(ptr) { printf("Allocated!") ; } else { printf("Error") ; }
15th May 2019, 12:19 PM
Théophile
Théophile - avatar