unordered set Question 10

Last Updated :
Discuss
Comments

Which option is correct for this program:

C++
#include <bits/stdc++.h>
using namespace std;

int main()
{
    unordered_set<int> s = {1, 2, 3};
    auto it = s.begin();
    *it = 4;
}


Valid

Compilation error

Undefined behavior

Runtime error

Share your thoughts in the comments