Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Arrays Or Vectors? [duplicate]

Tags:

c++

arrays

vector

Possible Duplicate:
When would you use an array rather than a vector/string?
What is the difference between std::array and std::vector? When do you use one over other?

I always use vectors (dynamic arrays) for everything, I never use normal arrays, is there any downside to this, for example, will there ever be a time when a vector will not suit, and a normal array will suit a function?

like image 458
killerloader Avatar asked Feb 24 '26 01:02

killerloader


1 Answers

According to Bjarne Stroustrup, you should use vector over Array unless you have a really good reason to use an array.

like image 67
Caesar Avatar answered Feb 25 '26 15:02

Caesar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!