Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Whats the difference between malloc and new, free and delete?

delete Free malloc
0
10 Posted

Whats the difference between malloc and new, free and delete?

0
10

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.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123