Difference between delete and delete[]?

Answer Posted / sunita shukla

Delete p deallocate memory pointed to by p and delete []p deallocate array. But delete p will delete only p[0]. Other array's Size-1 entries will not be deleted and this memory will leak.

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Who invented turbo c++?

831


What are compilers in c++?

828


What is the difference between new() and malloc()?

1180


What is the use of pointer in c++ with example?

775


What is the use of this pointer in c++?

780


What is the use of dot in c++?

828


What is format for defining a structure?

807


What can I safely assume about the initial values of variables which are not explicitly initialized?

811


Difference between Abstraction and encapsulation in C++?

818


What is an arraylist c++?

899


How a new operator differs from the operator new?

870


What are the different types of polymorphism in c++?

821


If there are two catch statements, one for base and one for derived, which should come first?

761


How compile and run c++ program in turbo c++?

844


What is data types c++?

758