What is the use of iterators to iterate over the characters of string if we can do it with a integer also?
Use of Iterator
Hey @himanshigupta579 its simply easier to work with different data structures by accessing them using iterators, be it sets ,strings, vectors or maps. You don’t need to know the internal working of the structure and can still iterate over it and access elements easily. Here is more on why iterators are used https://www.haroldserrano.com/blog/how-to-use-iterators-in-c