• Tutorials
  • Courses
  • Tracks

unordered map Question 8

Last Updated :
Discuss
Comments

What is the output of the program:

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

int main()
{
    unordered_map<int, int> m = {{1, 10}, {2, 20}};
    auto it = m.find(1);
    m.erase(it);
    cout << it->second;
    return 0;
}


10

20

Undefined behavior

Compilation error

Share your thoughts in the comments