I have a map to count the occurrence of words in a file. I am reading words from the file, and each time I read a word I want to do this:
map[word]++; //(where m
will my program crash because the int in my map is unitialized?
No; if the element with key word doesn't exist, the element will be created and value initialized. A value-initialized int has a value of 0.
word
int
0