Whats the difference between malloc and new, free and delete?
new is a C++ operator which will allocate memory AND call the constructor of the class for which’s object memory is being allocated. Free is a C function which will free up the memory allocated. but delete is a C++ operator which will free up the allocated memory AND call the destructor of the object.