What is the advantage of using new operator as compared to the function malloc? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is the advantage of using new operator as compared to the function malloc?

16th Jun 2019, 7:43 PM
Ujjawal Dubey
Ujjawal Dubey - avatar
2 Answers
+ 3
New will automatically gather the correct amount of memory needed iirc. Malloc needs your to specify
16th Jun 2019, 7:51 PM
Jackson O’Donnell
+ 2
~ swim ~ thanks again 😊
16th Jun 2019, 7:59 PM
Ujjawal Dubey
Ujjawal Dubey - avatar