When accessing an element of the map container by key in the case when such a key is missing, it is automatically added with a default value. Based on the example, the value 10 is put in dict[0]. Next, the value 0 will be put in dict[1]. When checking 10 != 0, and the value 100 will be put into dict[2]. As a result, the container will contain 3 elements.
Login in to like
Login in to comment