Possible Duplicate:
C++ STL vector vs array in the real world
To start of I have a little below average knowledge of C++ and advanced knowledge of C
Many times, I want to ask something code related and include or refer to some code and an array
comes up everyone instantly lock on this aspect and suggest I should instead use a vector
, even if it doesn't have to do anything related to my problem.
The problem is that this is the way I learned how to use C++, obviously something I inherited from learning plain C first, and I am quite used to it, although I feel confident about using vectors also, I just prefer arrays
over vectors
.
My questions are why should someone use a vector
instead of an array
, what does he earn by doing so, even if he is quite used to arrays?
Also if arrays
are not preferred over vectors
why doesn't everyone simply use vectors for everything?