Answers for "c++ how to skip the last element of vector"

C++
0

c++ how to skip the last element of vector

std::vector<int> x{1,2,3,4,5,6};

for (auto iter = x.begin(); iter != std::prev(x.end()); ++iter){
  std::cout << *iter << std::endl;
}
Posted by: Guest on June-17-2020

Code answers related to "c++ how to skip the last element of vector"

Browse Popular Code Answers by Language