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

Answer Posted / nishikant sahu

Yes you can but not recommend, b'c some time when you class
hold the heap memory it can't be free by "Free" b'c of no
constructor call happening via "Free" and you get the memory
leak. so use New/ delete or malloc/free pair.

Is This Answer Correct ?    3 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How should a contructor handle a failure?

668


What do you understand by a pure virtual member function?

527


What is the use of :: operator in c++?

583


Can you sort a set c++?

513


What is the c++ code?

559






What is a class template?

571


Describe new operator and delete operator?

610


Explain about Virtual Function in C++?

595


What is the full form of india?

552


Which operator cannot be overloaded c++?

576


What is bubble sort c++?

560


Define pointers?

591


What is linked list in c++?

672


Which is the best c++ compiler for beginners?

548


How do you clear a map in c++?

556