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 |
If you don’t declare a return value, what type of return value is assumed?
What is endianness?
What is a tree in c++?
What is expression parser in c++
Write a program using display() function which takes two arguments.
What is meaning of in c++?
Is c++ free?
What is constructor c++?
Why is c++ so fast?
write a program to add two numbers without using an arithmetic operator.
How can you quickly find the number of elements stored in a dynamic array?
Write about the scope resolution operator?