Question: what is the difference between new and malloc in c++?
Answer: The main difference between new and malloc is that new invokes the object's constructor and the corresponding call to delete invokes the object's destructor. ... new throws an exception on error, malloc returns NULL and sets errno. new is an operator and can be overloaded, malloc is a function and cannot be overloaded.