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

How one would use switch in a program?

592


Does there exist any way to make the command line arguments available to other functions without passing them as arguments to the function?

713


Explain terminate() and unexpected() function?

602


What are multiple inheritances (virtual inheritance)?

560


Does c++ have a hash table?

515






What does the nocreate and noreplace flag ensure when they are used for opening a file?

652


Is c# written in c++?

493


What are exceptions c++?

566


What is the purpose of templates in c++?

547


What is a stack c++?

547


What is the difference between an array and a list?

569


What is cin clear () in c++?

584


What is a forward referencing and when should it be used?

554


write asingle linked list which read from two list & the do the following 1 sort the prime & nonprime num (prime should be less tn nonprime) 2 each node has a prime num followd by nonprime 3 add a new node into its sutable plce 4 erase the most three duplicated non prime num 5 find the least duplicated prime num

2170


What is the difference between global variables and static varables?

541