ProgrammingModerate

A program makes three malloc calls and two free calls, with no other allocations. How many blocks are still allocated when the program ends, if it leaks nothing else?

  1. A. 0
  2. B. 2
  3. C. 1
  4. D. 3

Correct answer: C. 1

Each malloc creates one block and each free releases one. Three minus two leaves one block that was never freed.

More C Programming questions

Exams that ask this topic