What will happen if I allocate memory using "new" and free
it using "free" or allocate sing "calloc" and free it using
"delete"?

Answer Posted / roshan p.r.

Hi,

you cannot free a memory allocated with new using "free"
and in the same way callac with "delete"

because they are incompatable

Is This Answer Correct ?    0 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do c++ struct differs from the c++ class?

594


Can a class be static in c++?

573


Is c++ high level programming language?

681


Difference between Abstraction and encapsulation in C++?

580


What is size of string in c++?

559






Is there finally in c++?

628


Why do we learn c++?

533


When the constructor of a base class calls a virtual function, why doesn't the override function of the derived class gets called?

579


What does scope resolution operator do?

605


what is Loop function? What are different types of Loops?

645


What is the role of static keyword for a class member variable?

632


What is object in c++ example?

630


What is split a string in c++?

696


What is data type in c++?

562


What is constructor and destructor in c++?

623