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
Why cout is used in c++?
What is difference between malloc()/free() and new/delete?
How can virtual functions in c++ be implemented?
Why c++ is created?
Write a program to show polymorphism in C++?
What is the purpose of ios::basefield in the following statement?
Write a function that swaps the values of two integers, using int* as the argument type?
what is a reference variable in C++?
How does code-bloating occur in c++?
What is code reusability in c++?
How do I tokenize a string in c++?
Can comments be longer than one line?
How do you differentiate between overloading the prefix and postfix increments?
What is the difference between an enumeration and a set of pre-processor # defines?
List the merits and demerits of declaring a nested class in C++?