Should I used “dynamic allocating array” or “Vector”?

just read about Vector and it’s basically an improved array?
closed account (E0p9LyTq)
Yes.
Hello BambiWithPMS,

Yes this is true. At its core it is still an array, but an array that has many features, i.e., member functions, that a C style array does not have.

One of the big differences that a vector has is that you only use what you need. Generally with any of the other types of arrays; C style, C++ std::array, C lists you will have to set a size larger than you need and keep track of what you use. I may be a little off with the std::array and list because I do not use them that often.

When I first started learning C++ syntax vector was one of the first new containers I tried. After a short time I would prefer to use a vector over an array.

Personally I would stay away from dynamically allocating an array because when you are done with the array you need to remember to free the memory.

Hope that helps,

Andy
Topic archived. No new replies allowed.