WHAT IS THE DIFFERENCE BETWEEN malloc() and calloc() in c
file management?

Answer Posted / ananth kumar

malloc
Holds 1 argument data type
allocates memory byte equivalent to data type
not init alloted memory

Calloc
Holds 2 arguments, data type and number of datas (n)
allocates memory block equivalent to n * data type
clears alloted memory with 0

Is This Answer Correct ?    173 Yes 39 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the 4 types of unions?

621


Is register a keyword in c?

643


Which are low level languages?

648


What is assignment operator?

635


Can math operations be performed on a void pointer?

595






Why we use break in c?

560


Given below are three different ways to print the character for ASCII code 88. Which is the correct way1) char c = 88; cout << c << " ";2) cout.put(88);3) cout << char(88) << " "; a) 1 b) 2 c) 3 d) constant

678


Why double pointer is used in c?

576


Explain how can you restore a redirected standard stream?

598


What is meant by realloc()?

686


State the difference between realloc and free.

646


Can we add pointers together?

626


Describe the modifier in c?

612


What is typedef struct in c?

595


Why static is used in c?

629