C++ New And Delete Question:
Download Questions PDF

Can you please explain the difference between new and malloc and delete and free()


Delete is assocated with new and free(0 is associated with malloc()

Its an operator
delete is associated with new
It creates an object
It throws exceptions if memory is unavailable
Operator new can be overloaded
You can state the number of objects to be created.

It’s a function
free() is associated with malloc()
It does not create objects
It returns NULL
This cannot be overloaded
You need to specify the number of bytes to be allocated.

Download C++ New And Delete Interview Questions And Answers PDF

Previous QuestionNext Question
Explain realloc()?in C++, an object can be returned as argument:

a) false
b) true