Site navigation

In C programming, which library function is used for dynamic memory allocation?

Question and options

In C programming, which library function is used for dynamic memory allocation?
  1. malloc()
  2. alloc()
  3. new()
  4. memalloc()

Answer and explanation

Correct answer: A - malloc()
malloc() from stdlib.h allocates memory dynamically in C (also calloc and realloc). new is C++ and alloc/memalloc are not standard.

Practice for these exams

  • CUSAT CAT M.Sc. Forensic Science

  • Uttarakhand Judicial Services

    Subject revision

Related question papers

Related exam syllabi

More solved explanations in Computer fundamentals