Saturday, 25 February 2017

GATE EXAM PREPARATION IN "C" - Dynamic Memory Allocation

Which of the following is/are true
(A) calloc() allocates the memory and also initializes the allocates memory to zero, while memory allocated using malloc() has random data.
(B) malloc() and memset() can be used to get the same effect as calloc().
(C) calloc() takes two arguments, but malloc takes only 1 argument.
(D) Both malloc() and calloc() return ‘void *’ pointer.
(E) All of the above


Answer: (E) 

Explanation: All of the given options are true.

No comments:

Post a Comment