← Quiz: Iterators in C++: all 10 questions
Quiz: Iterators in C++ · Question 3 of 10
For a map<string,int iterator it, how do you read the value (not the key)?
For a map<string,int> iterator it, how do you read the value (not the key)?
- A.*it
- B.it.value
- C.it->second
- D.it[1]
Answer & explanation
Correct answer: it->second
Each map element is a pair; first is the key and second is the value.
Can you get the rest right without peeking?
Take the timed Quiz: Iterators in C++ quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →