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 are the advantages of using pointers in a program?
What is the latest c++ version?
What are the different types of comments allowed in c++?
What is abstract class in c++?
what are the iterator and generic algorithms.
What is the basic of c++?
What is struct c++?
Will a recursive function without an end condition every quit, in practice a) Compiler-Specific (Some can convert to an infinite loop) b) No c) Yes
What are stacks? Give an example where they are useful.
What is the difference between ++ count and count ++?
What happens when the extern "c" char func (char*,waste) executes?
What is the best c++ ide?
Incase of a function declaration, what is extern means?
Where is atoi defined?
What is function overloading c++?