map dada;
dada[\"dummy\"] = \"papy\";
cout << dada[\"pootoo\"];
I\'m puzzled because I don\'t know if it\'s considered
If you try to access a key value using index operator [], then 2 things can happen :
key. So it will return the corresponding key value.key. In this case, it will automatically add a key to the map with null value."pootoo" key does't exist in your map. So it will automatically add this key with value = ""(empty string). And your program will print empty string.
Here map size will increase by 1.
To search a key you can use map_name.find(), which will return map_name.end() if the key doesn't exist. And no extra key will be added.
You can use [] operator when you want to set value for a key.