LearnFrenzy
Sign in Take a free test

Pointers and Dynamic Memory · Pointers MCQ · Question 11

How to free memory from new int[10] Answer, explanation & discussion

  • MCQ
  • Easy
  • 0 comments
  • Answer explained
  • Moderated community
Question 11 Back to Exercise

How must int* a = new int[10]; be released?

  • A delete a;
  • B delete[] a; Correct
  • C free(a);
  • D It is freed automatically
Correct Answer: Option B

new[] pairs with delete[]. Mixing the forms – or with free – is undefined behaviour.

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links