why the memory allocated with new cant be freed using free()

Answer Posted / bharti

Because with new operator in C++ delete operator is used to
deallocate the memory. And with malloc() free() is used. S
it may not be supported by some of the compilers to free
memory with free() created by new.

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

• What are the desirable attributes for memory managment?

1719


What is encapsulation example?

542


Why is it so that we can have virtual constructors but we cannot have virtual destructors?

3813


Explain virtual inheritance?

680


What is polymorphism in oops?

553






There are two base class B1,B2 and there is one class D which is derived from both classes, Explain the flow of calling constructors and destructors when an object of derived class is instantiated.

1447


What is class and object in oops?

605


How do you achieve polymorphism?

605


What is abstraction in oops?

578


what type of question are asked in thoughtworks pair programming round ?

1752


What is the difference between a constructor and a destructor?

603


What type of loop is a for loop?

677


What does I oop mean?

609


What is the significance of classes in oop?

585


Why is encapsulation used?

569