What's the difference between calloc() and malloc()?

Answers were Sorted based on User's Feedback



What's the difference between calloc() and malloc()?..

Answer / guest

calloc() takes two arguments, and initializes the allocated
memory to all-bits-0.

Is This Answer Correct ?    9 Yes 0 No

What's the difference between calloc() and malloc()?..

Answer / k.thejonath

Malloc allocates a block of memory whereas using calloc we
can allocate array of memory blocks and all locations are
initialized to zeros

Is This Answer Correct ?    5 Yes 3 No

What's the difference between calloc() and malloc()?..

Answer / 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

What's the difference between calloc() and malloc()?..

Answer / bhaswati

malloc allocates m bytes means it takes one arguments.but calloc allocate m times n bytes and initialized the memory location to zero.it takes two arguments.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

What is f'n in math?

0 Answers  


explain how do you use macro?

0 Answers  


why programming language C is still used in operating system's kernel??

1 Answers   Wipro,


void main() { char far *farther,*farthest; printf("%d..%d",sizeof(farther),sizeof(farthest)); }

3 Answers   ME, pspl,


Explain can you assign a different address to an array tag?

0 Answers  






Differentiate between static and dynamic modeling.

0 Answers   Wipro,


What is n in c?

0 Answers  


whether itis a structured language?

1 Answers   Microsoft,


Why are all header files not declared in every c program?

0 Answers  


What is c token?

0 Answers  


While compiling a c program,graphics header files are not including in my program..eg: <graphics.h>,what may be the problem...is there any environment settings exists.

2 Answers  


What does malloc () calloc () realloc () free () do?

0 Answers  


Categories