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


Please Help Members By Posting Answers For Below Questions

Write a simple code fragment that will check if a number is positive or negative.

702


Explain the difference between null pointer and void pointer.

661


Write a program to print all permutations of a given string.

636


Explain how does free() know explain how much memory to release?

568


What is the use of clrscr?

587






What is the usage of the pointer in c?

596


Are global variables static in c?

664


What is d'n in c?

624


count = 0; for (i = 1;i < = 10; i++);count = count + i; Value of count after execution of the above statements will be a) 0 b) 11 c) 55 d) array

673


How do you define structure?

557


State the difference between realloc and free.

621


Why c language?

637


What is the difference between text and binary i/o?

586


Stimulate calculator using Switch-case-default statement for two numbers

2440


What are dangling pointers in c?

633