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

Why c is called a mid level programming language?

601


What is a const pointer in c?

667


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

704


Explain the advantages of using macro in c language?

572


What does a derived class inherit from a base class a) Only the Public members of the base class b) Only the Protected members of the base class c) Both the Public and the Protected members of the base class d) .c file

660






What are the main characteristics of c language describe the structure of ac program?

604


Write a code to generate divisors of an integer?

634


Explain what is the difference between a free-standing and a hosted environment?

632


c language supports bitwise operations, why a) 'c' language is system oriented b) 'c' language is problem oriented c) 'c' language is middle level language d) all the above

608


What is void main ()?

605


What is the use of putchar function?

646


What are predefined functions in c?

560


What is c language & why it is used?

574


Suggesting that there can be 62 seconds in a minute?

594


What is the difference between declaring a variable by constant keyword and #define ing that variable?

2695