-
What is the output of this program?
#include <iostream>
#include <iterator>
#include <list>
using namespace std;
int main ()
{
list<int> List1, List2;
for (int k = 0; k <= 3; k++)
{
List1.push_back(k);
List2.push_back(k * 12);
}
list<int> :: iterator Iter;
Iter = List1.begin();
advance (Iter, 3);
copy (List2.begin(), List2.end(), inserter(List1, Iter));
for ( Iter = List1.begin(); Iter != List1.end(); ++Iter )
cout << *Iter << " ";
return 0;
}
-
- 0 1 2 0 12
- Compilation Error
- 0 1 2 0 12 24 36 3
- 24 36 3
- None of these
Correct Option: C
In this iterator, We are copying the first list into second and printing it.