Home » C++ Programming » Questions and Answers » Question
  1. What is the output of this program?
     #include <iostream>
    #include <iterator>
    #include <vector>
    using namespace std;
    int main ()
    {
    vector<int> Number;
    for (int k = 0; k < 100; k++)
    Number.push_back(k);
    typedef vector<int> :: iterator iter_int;
    reverse_iterator<iter_int> rev_iterator;
    rev_iterator = Number.rend() - 6;
    cout << *rev_iterator << endl;
    return 0;
    }
    1. 100
    2. 6
    3. 5
    4. Compilation Error
    5. None of these
Correct Option: C

In this program, We are using the referencing operator and it can print the value currently pointing it.



Your comments will be displayed only after manual approval.