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
What is an incomplete type in c++?
Name four predefined macros.
Define whitespace in C++.
What is the difference between structures and unions?
What is the most powerful coding language?
Is it possible for a member function to delete the pointer, named this?
What is a container class? What are the types of container classes in c++?
What is a null object in c++?
Which c++ operator cannot overload?
What is c++ programming language?
What's the best free c++ profiler for windows?
How is computer programming useful in real life?
How can I improve my c++ skills?
What is a dynamic binding in c++?
How compile and run c++ program in turbo c++?