Check out example codes for "c++ looping through a vector". It will help you in understanding the concepts better.

Code Example 1

for(std::vector<T>::size_type i = 0; i != v.size(); i++) {
    v[i].doSomething();
}

Code Example 2

vector<int> vi;
...
for(int i : vi) 
  cout << "i = " << i << endl;

Learn ReactJs, React Native from akashmittal.com