Skip to content

Latest commit

 

History

History

33

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

Exercise 6.33

Write a recursive function to print the contents of a vector.

Solution

void print_vector(std::vector<int>::iterator beg,
                  std::vector<int>::iterator end)
{
    if (beg == end)
        return;
    std::cout << *beg++ << std::endl;
    print_vector(beg, end);
}