← Quiz: Memory and Smart Pointers: all 10 questions
Quiz: Memory and Smart Pointers · Question 3 of 10
Which correctly frees memory from new int[50]?
Which correctly frees memory from new int[50]?
- A.delete p;
- B.delete[] p;
- C.free(p);
- D.p = nullptr;
Answer & explanation
Correct answer: delete[] p;
Arrays allocated with new[] must be freed with delete[].
Can you get the rest right without peeking?
Take the timed Quiz: Memory and Smart Pointers quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →