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

How do I use turbo c++?

543


What is a linked list in c++?

536


What's the hardest coding language?

566


What is a class template?

577


What is iterator in c++?

602






Explain what are the sizes and ranges of the basic c++ data types?

631


Can I learn c++ as my first language?

595


What is the use of vtable?

656


What is & in c++ function?

580


Can we sort map in c++?

585


What do you understand by pure virtual function? Write about its use?

573


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

734


Differentiate between late binding and early binding. What are the advantages of early binding?

570


Does c++ support multilevel and multiple inheritances?

537


What is the use of typedef?

627