What is malloc and calloc in c program? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is malloc and calloc in c program?

experts . please help me

22nd Mar 2018, 4:02 PM
MadhanKumar S
MadhanKumar S - avatar
2 Answers
+ 7
malloc: The name malloc stands for "memory allocation". The function malloc() reserves a block of memory of specified size and return a pointer of type void which can be casted into pointer of any form. calloc: The name calloc stands for "contiguous allocation". The only difference between malloc() and calloc() is that, malloc() allocates single block of memory whereas calloc() allocates multiple blocks of memory each of same size and sets all bytes to zero. check this link to know the difference in table: http://cs-fundamentals.com/tech-interview/c/difference-between-malloc-and-calloc.php
22nd Mar 2018, 4:31 PM
Baraa AB
Baraa AB - avatar
0
cmon, a simple google sesrch is enough
22nd Mar 2018, 4:09 PM
Jeremy
Jeremy - avatar