Nepal's open education portal

EduNepalEduNepal
Objective1 markeasySolution

What is the return type of the malloc() function in C?

  • Aint*
  • Bchar*
  • Cvoid*
  • Dfloat
C Programming

Verified Solution & Step-by-Step Explanation

solution · en · Verified by Editorial Board

Correct Answer: (c) void*

Explanation: malloc() allocates raw memory on the heap and returns a generic pointer of type void*, which can be explicitly typecast to any pointer type (e.g., (int*)malloc(...)).