Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

for loop reverse C++

// Using iterators
for (auto it = s.crbegin() ; it != s.crend(); ++it) {
  std::cout << *it;
}

// Naive
for (int i = s.size() - 1; i >= 0; i--) {
  std::cout << s[i];
}
Source by www.techiedelight.com #
 
PREVIOUS NEXT
Tagged: #loop #reverse
ADD COMMENT
Topic
Name
3+3 =