Microsoft Interview Question: What is the difference betwee... | Glassdoor

Interview Question

Software Developer Engineer Intern Interview(Student Candidate) Bellevue, WA

What is the difference between malloc and calloc.

Answer

Interview Answer

1 Answer

0

malloc allocates a block of uninitialized memory and returns a pointer to that block of memory. Its signature is along the lines of void* malloc( unsigned long size ).

calloc allocates a block of cleared memory and returns a pointer to that block of memory. Its signature is along the lines of void* calloc( unsigned long size, unsized long count ).

Tim on Feb 28, 2012

Add Answers or Comments

To comment on this, Sign In or Sign Up.