Shall we use 'free' to free memory assigned by new, What are
the further consequences??
Answer Posted / krishnarao panchadi
Syntactically we can use "free" in place of "delete". But
semantically it is senseless as it wont call the destructor.
Note that, deallocating is not the only purpose of
using "delete". The destructor should also be called if you
call the constructor(while creating the object).
Failing to call "delete" may lead to system crash.
Using "free" wont call the desturctor.
Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
Is python better than c++?
How much do coding jobs pay?
What is a linked list in c++?
I want explanation for this assignment: how to connect mysql database using c/c++,please explain this detailly?
What does it mean to declare a destructor as static?
What is a class template in c++?
What is ofstream c++?
Why is c++ so fast?
How delete [] is different from delete?
Comment on local and global scope of a variable.
What are pointer-to-members? Explain.
What is std namespace in c++?
What is increment operator in c++?
When we use Abstract Class and when we use Interface?where we will implement in real time?
Is c++ free?