Explain difference between calloc and malloc with an example. | Sololearn: Learn to code for FREE!
+ 1

Explain difference between calloc and malloc with an example.

15th Apr 2022, 5:07 AM
Abhivarshini Maddala
Abhivarshini Maddala - avatar
1 Antwort
+ 3
calloc allocates memory and initializes it to zeros whereas malloc does not initialize the memory which still contains whatever values were there...source of unpredictable behavior if you don't address this in your code.
15th Apr 2022, 6:36 AM
Paul K Sadler
Paul K Sadler - avatar