Dynamic Memory | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Dynamic Memory

Can we use malloc()/free() instead of new/delete in C++?

6th Oct 2017, 9:46 PM
Srinidhi Krishnan Bengaluru
Srinidhi Krishnan Bengaluru - avatar
2 Answers
+ 1
Yes. After all, new and delete are just operators that eventually call malloc and free. Keep in mind that malloc and free will not call constructors and deconstructors on its own though.
6th Oct 2017, 10:06 PM
aklex
aklex - avatar
0
thank you
6th Oct 2017, 10:07 PM
Srinidhi Krishnan Bengaluru
Srinidhi Krishnan Bengaluru - avatar