The stack and the heap What is the difference between new/delete and malloc/free? Overriding new and delete

What happen when 'delete p' is executed?

// Original code: delete p;
if (p) { // or "if (p != nullptr)"
 p->~deconstructor();
 operator delete(p);
}

here

Do I need to check for null before delete p?

No here

results matching ""

    No results matching ""