Q676
What will be the output of the following C++ code? #include #include #include using namespace std; int main() forward_list fl1 = 1,2,3,4,5; for (int&c : fl1) cout ::iterator ptr = fl1.begin(); fl1.erase_after(ptr); for (int&c : fl1) cout << c << " "; cout<<endl; return 0;
A.
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
B.
1 2 3 4 5
1 3 4 5
Answer1 3 4 5
C.
1 2 3 4 5
2 3 4 5
2 3 4 5
D.
1 2 3 4 5
1
1
Answer: Option B
Solution
Answer: Option B
No explanation is given for this question Let's Discuss on Board