forward_list Question 10

Last Updated :
Discuss
Comments

What is the missing line of code in this code to print maximum of two numbers?

C++
#include <bits/stdc++.h>
using namespace std;
int main()
{
    list<int> l = {1, 2, 3, 4};
    auto it = l.front();
    it++;
    cout << *(it);
}


Compilation error

Undefined behaviour

2

1

Share your thoughts in the comments