WHAT IS THE DIFFERENCE BETWEEN malloc() and calloc() in c
file management?
Answer Posted / smitha
Malloc:
1. Takes only 1 argument- the size of the memory block to
be allocated.
2. Allocates memory as a single contiguous block.
3. Will fail if a single contiguous memory block of
required size is not available.
Calloc:
1. Takes two arguments - the number of memory blocks needed
and the size of each memory block.
2. It may or may not allocate a single contiguous block,
thus will not fail if a single contiguous memory block
of required size is not available.
3. Initialises the memory blocks to 0.
| Is This Answer Correct ? | 17 Yes | 3 No |
Post New Answer View All Answers
What is the difference between %d and %i?
can anyone please tell about the nested interrupts?
What is a global variable in c?
how to create duplicate link list using C???
How do you initialize pointer variables?
Explain what are bus errors, memory faults, and core dumps?
Why are algorithms important in c program?
Given two strings S1 and S2. Delete from S2 all those characters which occur in S1 also and finally create a clean S2 with the relevant characters deleted.
What is union and structure in c?
printf(), scanf() these are a) library functions b) userdefined functions c) system functions d) they are not functions
Is c compiled or interpreted?
write a program in c language to print your bio-data on the screen by using functions.
which of the following statement is wrong a) mes=123.56; b) con='T'*'A'; c) this='T'*20; d) 3+a=b;
How many keywords are there in c?
what is the function of pragma directive in c?