• Tutorials
  • Courses
  • Tracks

unordered map Question 6

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}};
    m.clear();
    cout << m.size() << " " << m[1];
}


0 garbage value

0 0

0 1

Error

Share your thoughts in the comments