• Tutorials
  • Courses
  • Tracks

unordered map Question 4

Last Updated :
Discuss
Comments

What is the output of the program:

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

int main()
{
    unordered_map<int, string> myMap;
    myMap[1] = "one";
    myMap[2] = "two";
    cout << myMap[3] << endl;
    return 0;
}


An empty string

"two"

undefined behavior

Error

Share your thoughts in the comments