difference between malloc and calloc

Answer Posted / vara

There are two differences.
1) is the number of arguments. Malloc() takes a single
argument (memory required in bytes), while calloc() needs
two arguments (number of variables to allocate memory, size
in bytes of a single variable).
2)malloc() does not initialize the memory allocated, while
calloc() initializes the allocated memory to ZERO.

Is This Answer Correct ?    15 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the benefits of organizational structure?

577


What is function in c with example?

635


Describe newline escape sequence with a sample program?

660


Which is more efficient, a switch statement or an if else chain?

585


Can one function call another?

630






Explain what is the benefit of using enum to declare a constant?

593


Write a program to generate random numbers in c?

666


Explain two-dimensional array.

632


What is the difference between Printf(..) and sprint(...) ?

792


Differentiate between functions getch() and getche().

627


What is assert and when would I use it?

584


Can true be a variable name in c?

561


where are auto variables stored? What are the characteristics of an auto variable?

597


What do you mean by c?

592


How is actual parameter different from the formal parameter?

596