What is a vector? Why would I use it rather anything else?
Asked
Active
Viewed 25 times
0
-
1I think the question should be: When should you **not** use a vector? std::vector is your general purpose go-to container. – He3lixxx May 25 '21 at 20:30
-
"*What is a vector?*" - any [decent C++ book](https://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list) should cover that. – Remy Lebeau May 25 '21 at 20:31
-
for basic reference https://www.edureka.co/blog/vectors-in-cpp/ – thirdeye May 25 '21 at 20:31
1 Answers
0
A vector is a dynamically sized array. Use it whenever you need an array of elements that are stored contiguously in memory but you do not know the array's size at compile-time, only at runtime.

Remy Lebeau
- 555,201
- 31
- 458
- 770