What is the difference between new/delete and malloc/free?

前端 未结 15 2720
春和景丽
春和景丽 2020-11-21 23:53

What is the difference between new/delete and malloc/free?

Related (duplicate?): In what cases do I use malloc vs

15条回答
  •  情话喂你
    2020-11-22 00:24

    In C++ new/delete call the Constructor/Destructor accordingly.

    malloc/free simply allocate memory from the heap. new/delete allocate memory as well.

提交回复
热议问题