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

Explain how a pointer to function can be declared in C++?

570


Write a program to encrypt the data in a way that inputs a four digit number and replace each digit by (the sum of that digit plus 7) modulus 10. Then sweep the first digit with the third, second digit with the fourth and print the encrypted number.

2081


Which recursive sorting technique always makes recursive calls to sort subarrays that are about half size of the original array?

599


What is the oldest programming language?

555


What is the purpose of extern storage specifier?

609






How many types of scopes are there in c++?

565


What is the difference between while and do while loop?

544


What do you mean by volatile and mutable keywords used in c++?

563


What is :: operator in c++?

563


How do you establish an is-a relationship?

609


What is input operator in c++?

574


Do you know the problem with overriding functions?

563


What is istream and ostream in c++?

578


What is wrapper class in c++?

619


what are the types of Member Functions?

600