What's the difference between calloc() and malloc()?
Answer Posted / valli
the diffence is
1.prototype or no of arguments
calloc takes two arguments
where as malloc takes 1 argument
void *calloc(int ,int);
first argument is no of blocks required
secund argument is no of elementts in each block required
void *malloc(int);
in this total no of bytes reuired are taken as the argument
2.
calloc clears the bytes which are allocated or reserved
where malloc can not guarentee this
sorry for my poor english
| Is This Answer Correct ? | 2 Yes | 1 No |
Post New Answer View All Answers
What is scanf_s in c?
What is data structure in c programming?
What library is sizeof in c?
Why is c known as a mother language?
What are different storage class specifiers in c?
PROGRAM TO WRITE CONTENTS OF 1 FILE IN REVERSE TO ANOTHER FILE,PROGRAM TO COPY 1 FILE TO ANOTHER BY SPECIFYING FILE NAMES AS COMMAND LINE
What is the size of structure in c?
Explain the use of 'auto' keyword
Explain what are linked list?
What is the difference between class and object in c?
What should malloc(0) do?
What is this pointer in c plus plus?
Can a function argument have default value?
Explain what is a 'null pointer assignment' error? Explain what are bus errors, memory faults, and core dumps?
What is a void pointer in c?