Range-based for loop is better for container . Strings, arrays, and all STL containers can be iterated over with the new range-based for loop already https://www.cprogramming.com/c++11/c++11-ranged-for-loop.html