This question was asked to me in an interview:
In C++,
- what if we allocate memory using
malloc
and usedelete
to free that allocated memory?- what if we allocate the memory using
new
and free it usingfree
?What are the problems that we would face if the above things are used in the code?
My answer was there is no difference. Was I right in saying so?