How to Access Individual Characters in a C++ String? Last Updated : 23 Jul, 2025 Comments Improve Suggest changes Like Article Like Report C++ has in its definition a way to represent a sequence of characters as an object of the class. This class is called std:: string. The string class stores the characters as a sequence of bytes with the functionality of allowing access to the single-byte character. In this article, we are going to learn how to access individual characters in a C++ String. Example Input:myString = "GeeksforGeeks";Output:4th Character = kAccess Individual Characters in a C++ StringIn C++, you can access individual characters in a std::string using the array subscript [] operator. We need to just pass the index between the [] operator. Indexing of string starts with 0. C++ Program to Access Individual Characters in a String C++ // C++ Program to Access Individual Characters in a String #include <iostream> #include <string> // Driver Code int main() { std::string str = "Hello"; // Accessing individual characters using iterators std::string::iterator it = str.begin(); char firstChar = *it; // Accessing the first character // You can also use ++ operator to move the iterator ++it; // Move to the next character ++it; // Move to the third character char thirdChar = *it; std::cout << "First character: " << firstChar << std::endl; std::cout << "Third character: " << thirdChar << std::endl; return 0; } OutputFirst character: H Third character: l Time complexity: O(1)Space Complexity: O(1) Create Quiz Comment M mohitrajora Follow 0 Improve M mohitrajora Follow 0 Improve Article Tags : C++ Programs C++ cpp-strings CPP Examples Explore C++ BasicsIntroduction to C++3 min readData Types in C++6 min readVariables in C++4 min readOperators in C++9 min readBasic Input / Output in C++3 min readControl flow statements in Programming15+ min readLoops in C++7 min readFunctions in C++8 min readArrays in C++8 min readCore ConceptsPointers and References in C++5 min readnew and delete Operators in C++ For Dynamic Memory5 min readTemplates in C++8 min readStructures, Unions and Enumerations in C++3 min readException Handling in C++12 min readFile Handling in C++8 min readMultithreading in C++8 min readNamespace in C++5 min readOOP in C++Object Oriented Programming in C++8 min readInheritance in C++6 min readPolymorphism in C++5 min readEncapsulation in C++3 min readAbstraction in C++4 min readStandard Template Library(STL)Standard Template Library (STL) in C++3 min readContainers in C++ STL2 min readIterators in C++ STL10 min readC++ STL Algorithm Library3 min readPractice & ProblemsC++ Interview Questions and Answers1 min readC++ Programming Examples4 min read Like