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
When is the destructor called?
Describe linked list using C++ with an example.
Why is c++ considered difficult?
Can non-public members of another instance of the class be retrieved by the method of the same class?
What is the use of lambda in c++?
How do c++ struct differs from the c++ class?
Which software is best for coding?
Describe protected access specifiers?
How do you declare A pointer to a function which receives nothing and returns nothing
Can you use the function fprintf() to display the output on the screen?
Is c++ free?
If a round rectangle has straight edges and rounded corners, your roundrect class inherits both from rectangle and from circle, and they in turn both inherit from shape, how many shapes are created when you create a roundrect?
Why should you learn c++?
Why c++ is the best language?
If we want that any wildcard characters in the command line arguments should be appropriately expanded, are we required to make any special provision? If yes, which?