Question 80Asked in BPSC TRE 2.0 (2023) Computer Class 9-10What is the difference between delete and delete[ ] in C++?
- ADelete is syntactically correct but delete[ ] is wrong and hence will give an error if used in any case
- BDelete is used to delete normal objects whereas delete[ ] is used to delete pointer objects
- CDelete is used to delete single object whereas delete[ ] is used to delete multiple (array/pointer of) objects
- DMore than one of the above
- ENone of the above
Show answerHide answer
Correct answer: (C) Delete is used to delete single object whereas delete[ ] is used to delete multiple (array/pointer of) objects
Explanation
delete frees a single object, while delete[] frees an array of objects (and calls each destructor).