C++ Language/Std/Strings/StringClass/Indexing

Like any STL collection, you could iterate through string data using. A  object uses contiguous memory for storing its characters. Application code is allowed to directly access the un-terminated character data (either via  or  ) as long as it stays within the string's allocation area, and finishes its work before the next   operation. More conveniently,  is like   except that   temporarily adds a   at the end of the data-characters (making the buffer temporarily compatible with C-Runtime functions).

Additional information about string indexing (includes interactive examples)