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
Explain static and dynamic memory allocation with an example each.
Why is main an int?
What is null pointer and void pointer and what is their use?
Can constructor be private in c++?
Explain the advantages of using friend classes.
Will c++ be replaced?
Is rust better than c++?
What is an adaptor class in c++?
What is the use of dot in c++?
Define the process of handling in case of destructor failure?
Who made c++?
Which is the best c++ compiler?
What is doubly linked list in c++?
Which is not a valid keyword a) public b) protected c) guarded
How can you specify a class in C++?