Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

Is java the same as c++?

1003


You have two pairs: new() and delete() and another pair : alloc() and free(). Explain differences between eg. New() and malloc()

1175


What is the difference between global variables and local variable

1075


Discussion on error handling of C++ .

1131


What's the hardest coding language?

1010


Explain "const" reference arguments in function?

1076


Should you pass exceptions by value or by reference?

1142


What is the use of 'using' declaration in c++?

1149


Can you be bale to identify between straight- through and cross- over cable wiring? And in what case do you use straight- through and cross-over?

1004


Is c++ vector dynamic?

1144


Should I learn c++ c?

1063


Explain differences between new() and delete()?

1107


What are the two types of comments?

1012


How many namespaces are there in c++?

1082


What is the first name of c++?

1079