Multiple choice

With every use of a memory allocation function, what function should be used to release allocated memory which is no longer needed?

  1. unalloc()

  2. dropmem()

  3. dealloc()

  4. release()

  5. free()

Reveal answer Fill a bubble to check yourself
E Correct answer
Explanation

free() is the standard C library function used to release dynamically allocated memory that was obtained using malloc(), calloc(), or realloc(). Every call to a memory allocation function should have a corresponding call to free() to prevent memory leaks.