1.

Select the right statement with reference to malloc() and calloc().(a) malloc() does not set the memory to zero whereas calloc() sets allocated memory to zero(b) malloc() sets the memory to zero whereas calloc() does not set allocated memory to zero(c) malloc() sets the memory to zero whereas calloc() sets allocated memory to zero(d) malloc() does not set the memory to zero whereas calloc() does not set allocated memory to zeroI have been asked this question during an interview.My question comes from General Utilities topic in chapter C Library of C

Answer»

The correct choice is (a) malloc() does not SET the memory to zero WHEREAS calloc() SETS allocated memory to zero

To EXPLAIN: The DIFFERENCE in malloc() and calloc() is that calloc() sets the memory to zero whereas malloc()does not sets allocated memory to zero.



Discussion

No Comment Found

Related InterviewSolutions