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 / sanjay makwana, puna

When you allocate a memory using new then constructor will
be called but when use a free that time destructor will not
be called.

Same vice versa for calloc and delete.

Is This Answer Correct ?    6 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between structure and class?

562


How many keywords are used in c++?

560


Do the parentheses after the type name make a difference with new?

655


Write a short code using c++ to print out all odd number from 1 to 100 using a for loop

588


What are the advantages of inheritance in c++?

657






What are the different types of polymorphism in c++?

591


What is meant by iomanip in c++?

612


Are there any special rules about inlining?

585


Is it possible to have a recursive inline function in c++?

557


Explain the operation of overloading of an assignment operator.

698


How do I download c++?

573


What is problem with overriding functions?

611


What is a constructor in c++ with example?

582


Show the declaration for a pointer to function returning long and taking an integer parameter.

581


what is scupper?

1895