Vidyalelo
C Programming · Q22

Memory Allocation

Programming · C Programming · question 22

Q22

What is the difference between 'malloc' and 'calloc' in C?

A.
'malloc' allocates uninitialized memory, 'calloc' allocates and initializes to zero
Answer
B.
'malloc' allocates and initializes to zero, 'calloc' allocates uninitialized memory
C.
'malloc' is used for arrays, 'calloc' is used for single elements
D.
'malloc' allocates memory from the stack, 'calloc' allocates from the heap

Answer: Option A

Solution

Answer: Option A
No explanation is given for this question Let's Discuss on Board