What will happen if I allocate memory using "new" and free
it using "free" or allocate sing "calloc" and free it using
"delete"?
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / ekta
free is not compatible with new.
free wont recognise the memory allocated by new and should
gie some error i guess.
| Is This Answer Correct ? | 0 Yes | 1 No |
Answer / 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 |
What are the advantages of c++? Explain
Explain the isa and hasa class relationships. How would you implement each?
What doescout<<(0==0) print out a) 0 b) 1 c) Compiler error: Lvalue required
What is conversion constructor?
Write about the stack unwinding?
Explain how to initialize a const member data.
How to create a pure virtual function?
Why is "using namespace std;" considered bad practice?
Is c++ a low level language?
What is virtual destructor? What is its use?
What is the use of map in c++?
What is c++ and its uses?