Difference between delete and delete[]?

Answer Posted / vikas

If p is pointer to an array and is allocated memory on
heap, then delete p would call the destructor of the first
element but will free up the whole block. More info at:

http://www.cppquestions.com/viewtopic.php?f=27&t=13

Is This Answer Correct ?    14 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is iostream in c++ used for?

726


What is srand c++?

810


Define pre-condition and post-condition to a member function in c++?

878


What is atoi in c++?

805


How is new() different from malloc()?

839


What is class definition in c++ ?

817


What is ios flag in c++?

867


What is the difference between struct and class?

1032


How do you declare A pointer to function which receives an int pointer and returns a float pointer

886


Write a program in C++ for Fibonacci series

860


What is a catch statement?

774


Specify some guidelines that should be followed while overloading operators?

846


What are shallow and deep copies?

843


Why namespace is used in c++?

779


Can constructor be private in c++?

780