Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

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;
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #skip #element #vector
ADD COMMENT
Topic
Name
9+8 =