Shall we use 'free' to free memory assigned by new, What are
the further consequences??

Answer Posted / guest

Yes we can use free which was assigned by new.but in this
case no destrctor will be called as free doesn't call this.
So it is recommended that we should not use free if we
allcoate the memory using new.

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What's the order in which the objects in an array are destructed?

862


Differentiate between late binding and early binding.

644


Differentiate between structure and class in c++.

604


If you want to share several functions or variables in several files maitaining the consistency how would you share it?

554


What is double in c++?

563






What is a wchar_t in c++?

587


What is the benefit of c++?

604


How would you implement a substr() function that extracts a sub string from a given string?

570


What are advantages of using friend classes?

642


Is c++ slower than c?

577


What is general form of pure virtual function? Explain?

515


Which c++ compiler is best?

590


What is the use of endl?

550


What is an associative container in c++?

555


Is there structure in c++?

594