Q:

Use reverse_iterators to print a vector in reverse order

0

Use reverse_iterators to print a vector in reverse order.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#include <vector>
#include <iostream>

int main() {
  std::vector<int> vi{0, 1, 2, 3, 4, 5};
  for (auto it = vi.crbegin(); it != vi.crend(); ++it)
    std::cout << *it << " ";
  std::cout << std::endl;

  return 0;
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now