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

Create a structure to specify data on students as given below: Roll number, Name, Department, Course, and Year of joining. Assume that there are not more than 450 students in the collage. (a) Write a function to print the names of all students who joined in the last 3 years. (b) Write a function to print the data of a student whose roll numbers are divisible by 4.

594


Why we use int main and void main?

533


Is c procedural or functional?

582


In c programming, explain how do you insert quote characters (? And ?) Into the output screen?

758


What is bubble sort in c?

631






How do you construct an increment statement or decrement statement in C?

737


Describe the complexity of Binary search, Quicksort and various other sorting and searching techniques..

642


What is an lvalue in c?

692


What is meant by initialization and how we initialize a variable?

581


How can I ensure that integer arithmetic doesnt overflow?

604


What is the difference between new and malloc functions?

574


application areas a 'c' a) operating system b) graphics, interpreter, assembler c) program evalution, communication softwares d) all the above

601


what is bit rate & baud rate? plz give wave forms

1512


Write programs for String Reversal & Palindrome check

594


How can I manipulate strings of multibyte characters?

631