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

Why is C language being considered a middle level language?

637


How can type-insensitive macros be created?

684


What is the size of empty structure in c?

579


Explain what is the advantage of a random access file?

648


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

597






How would you rename a function in C?

602


Explain what is page thrashing?

597


What are compound statements?

616


I just typed in this program, and it is acting strangely. Can you see anything wrong with it?

544


hi to every one .. how to view table pool after creating the pooled table? plz help me.. if any knows abt this ..

1448


What is bss in c?

590


Explain how can you determine the size of an allocated portion of memory?

608


What are conditional operators in C?

614


Explain modulus operator. What are the restrictions of a modulus operator?

587


What is operator precedence?

628