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 uninitialized 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
Explanation: All of the given options are true. See https://www.geeksforgeeks.org/calloc-versus-malloc/ for details.
Quiz of this Question
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- C | Dynamic Memory Allocation | Question 1
- C | Dynamic Memory Allocation | Question 2
- C | Dynamic Memory Allocation | Question 3
- C | Dynamic Memory Allocation | Question 5
- C | Dynamic Memory Allocation | Question 6
- C | Dynamic Memory Allocation | Question 7
- C | Dynamic Memory Allocation | Question 8
- Dynamic Memory Allocation in C using malloc(), calloc(), free() and realloc()
- Program to find largest element in an array using Dynamic Memory Allocation
- Difference between Static and Dynamic Memory Allocation in C
- How to restrict dynamic allocation of objects in C++?
- MCQ on Memory allocation and compilation process
- If memory allocation using new is failed in C++ then how it should be handled?
- How are variables scoped in C - Static or Dynamic?
- How to create a dynamic 2D array inside a class in C++ ?
- Sorting a dynamic 2-dimensional array of Strings
- What is Memory Leak? How can we avoid?
- How will you show memory representation of C variables?
- How does free() know the size of memory to be deallocated?
- Memory Layout of C Programs
Improved By : ryan5