🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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)?

  1. A.*it
  2. B.it.value
  3. C.it->second
  4. 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 →