Launch offer
Business website $150 USD Custom plugin $200 USD Ready in 5 days
Get a quote
C++

new and delete in C++

Use new/delete (and new[]/delete[]) when you must manage raw ownership.

new and delete in C++ — a practical guide to C++ new delete with clear examples you can reuse in real projects.

C++ Tutorial Series (50/111). Prefer one article? Read the complete C++ tutorial.

Short description

Never mix new with free, or new[] with delete.

new/delete

int* p = new int(42);
// ...
delete p;
p = nullptr;

Leave a reply

Your email address will not be published. Required fields are marked *