What will be printed out as a result of the following code execution? (C++11)
#include <iostream>
#include <vector>
using namespace std;

void f(const vector<int>& v)
{
    for(auto i: v)
        i=0;
}

int main()
{
    vector<int> v{1,1};
    for(int i=0; i!=5; ++i)
        v.push_back(v[v.size() - 1] + v[v.size() - 2]);
    f(v);
    for(auto i: v)
        cout << i << ' ';
}

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Cosmo
Sign Up Now
or Subscribe for future quizzes