Memory allocated with int* p = new int; must be released with which statement?
Correct answer B. delete[] p;
Explanation
new[] must be paired with delete[], so that the runtime knows an array was allocated and calls every element's destructor. Using plain delete on an array, or free() on memory from new, is undefined behaviour. Simply setting p to nullptr leaks the memory. In modern code std::vector or std::unique_ptr handles this pairing for you.
Answer checked How we write and check questions
Discussion