Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / programming

C++ Tip: Aware of the confusion between delete with delete[]

4.80/5 (4 votes)
1 Oct 2010CPOL 11.9K  
The C++ comes with a rich standard library: the STL (Standard Template Library).So, why we should re-invent the wheel while we already have it done, safe and written to be light-weighed and performant?It's too much better to use the vector Class (Standard C++ Library)[^]:#include...
The C++ comes with a rich standard library: the STL (Standard Template Library).
So, why we should re-invent the wheel while we already have it done, safe and written to be light-weighed and performant?
It's too much better to use the vector Class (Standard C++ Library)[^]:

C++
#include <vector>

...

std::vector<int> a(10); // Pre-allocate an array of 10 int

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)