difference between malloc and calloc

Answer Posted / namita

1-memory allocated by malloc contains garbage value.But
memory allocated by calloc is initialised to zero.

2-malloc takes only one argument which indicates the size
to be allocated.But calloc takes two arguments.First
argument indicates the number of blocks to be allocated
where as the second argument indicates the size of the
block.

Is This Answer Correct ?    35 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does c mean?

757


Explain how do you use a pointer to a function?

823


One of the Institutes contains 5 student groups. Every group contains 4 students. Institute wants to store student group’s details in array. Group should contain group member’s details (name and registration number and age), project name, and mark of the group.

2386


What does stand for?

809


Why is c known as a mother language?

945






illustrate the use of address operator and dereferencing operator with the help of a program guys plzzz help for this question

1816


Compare interpreters and compilers.

802


What is the difference between printf and scanf )?

773


Explain what is the difference between functions getch() and getche()?

768


What are the different types of endless loops?

807


What is bubble sort in c?

803


What is the purpose of scanf() and printf() functions?

891


What's the right way to use errno?

828


How do you view the path?

860


What is the general form of a C program?

764