C | Dynamic Memory Allocation | Question 5
What is the return type of malloc() or calloc()
(A) void *
(B) Pointer of allocated memory type
(C) void **
(D) int *
Answer: (A)
Explanation: malloc() and calloc() return void *.
We may get warning in C if we don’t type cast the return type to appropriate pointer.
Quiz of this Question
Recommended Posts:
- C | Dynamic Memory Allocation | Question 7
- C | Dynamic Memory Allocation | Question 3
- C | Dynamic Memory Allocation | Question 6
- C | Dynamic Memory Allocation | Question 1
- C | Dynamic Memory Allocation | Question 2
- C | Dynamic Memory Allocation | Question 8
- C | Dynamic Memory Allocation | Question 8
- Dynamic Memory Allocation in C using malloc(), calloc(), free() and realloc()
- MCQ on Memory allocation and compilation process
- How to restrict dynamic allocation of objects in C++?
- IPC through shared memory
- Memory leak in C++ and How to avoid it?
- How to deallocate memory without using free() in C?
- Memory Layout of C Programs
- What is Memory Leak? How can we avoid?

