Originally Posted by
Daved
It's fine to use array syntax to loop through a vector.
There are more advanced things you can do with iterators, and they are a more generic concept. If you have a function (like sort for example) that works on a container, then you can have it take iterators so that it works with any container that supports that kind of iteration.
Also, in some cases you may want to use the iterator version to loop through a vector because it can be easier to update the code if you switch to a different container type later.