What is the difference between "calloc" and "malloc"?
Answers were Sorted based on User's Feedback
Answer / shweta
calloc initializes memory with 0 while malloc doesn't
|Is This Answer Correct ?||25 Yes||4 No|
Answer / ven
In addiion, calloc requires two parameters whereas ,malloc
|Is This Answer Correct ?||19 Yes||6 No|
Answer / vijay
Calloc allocates the array of blocks of memory whearas
malloc allocates the memory of the size given as an
|Is This Answer Correct ?||12 Yes||2 No|
Answer / saugat biswas
Malloc allocates memory but does not initialize it.
Example: char *szPtr = ( char* ) malloc( sizeof( char ) *
Here szPtr is assigned 100 bytes. But the memory is not
initialized. It contains garbage.
Allocates a block of memory for an array of 'n' elements,
each of them 'l' bytes long, and initializes all its bits
Example: char *szPtr = ( char* ) calloc( 100, sizeof(
Here szPtr is assigned 100 bytes & the memory is
initialized to 0.
|Is This Answer Correct ?||11 Yes||2 No|
Answer / subhrajit
mallco is used in c language for static memory location in
heap area and i donot no the calloc.
|Is This Answer Correct ?||1 Yes||0 No|
Answer / samveethsingh
malloc create the single block of given size by user
calloc creates multiple blocks of given size
|Is This Answer Correct ?||0 Yes||0 No|
Answer / edwin
malloc - create the memory space
calloc-calculate the memory space
|Is This Answer Correct ?||0 Yes||4 No|
Answer / srikanth
MALLOC ASSIGNS O VALUE , WHERE AS CALLOC ASSIGNS GARBAGE
|Is This Answer Correct ?||3 Yes||27 No|
what are the events occur in intr activated on interrupt vector table
why c++ is not called strictly d super set of c?
Write a program to calculate the BMI of a person using the formula BMI = weight/height2.
i have given a project to create examination seating plan system in c++. so can anyone send me the answer of this question quickly??????
5. Can inline functions have a recursion?
program explaining feautures of c++
Write a program to reverse a linked list?
What is scope of a variable? (LOLZ)
Give 2 examples of a code optimization?
What is the stack?
Is structure can be inherited?
given unsigned int ui1=3,ui2=7; what are the outputs of a)ui1 & ui2 b)ui1 && ui2 c)ui1 | ui2 d)ui1 || ui2 i also need the justification for the answers thank you