1.

Which is the correct syntax to delete an array of objects?(a) delete [] objectName;(b) delete * objectName;(c) objectName[] delete;(d) delete objectName[];I got this question in my homework.This question is from Delete Operator in chapter Memory Allocation & Scope of Variable of Object Oriented Programming

Answer»

Right OPTION is (a) DELETE [] objectName;

EXPLANATION: The OBJECT array that has to be deleted is mentioned after the keyword delete. But after delete, empty square brackets have to be given to denote that the deletion have to be done on array of objects.



Discussion

No Comment Found

Related InterviewSolutions