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?
- malloc()
- alloc()
- new()
- 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