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

Can static member variables be private?

711


What are the advantages of using typedef in a program?

728


How do I make turbo c++ full screen?

672


Is c++ proprietary?

666


Comment on assignment operator in c++.

810






Explain all the C++ concepts using examples.

788


What is an overflow error?

717


Can we specify variable field width in a scanf() format string? If possible how?

755


What is the difference between equal to (==) and assignment operator (=)?

667


What are c++ manipulators?

702


Who discovered c++?

656


What is conditions when using boolean operators?

695


Which is the best c++ compiler?

679


What is public, protected, private in c++?

767


How compile and run c++ program in turbo c++?

743