Javatpoint Logo
Javatpoint Logo

C++ String at()

This function is used for accessing individual characters.

Syntax

Consider a string str. To find the position of a particular character, its syntax would be

Parameters

pos : It defines the position of the character within the string.

Return value

It returns the character specified at that position.

Example 1

Output:

String contains Welcome to javatpoint tutorial

Example shows that we can access the characters by using either the member function at() or the subscript operator[ ].


Next TopicC++ Strings





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA