String Rbegin Function - C++ Programming Tutorial
C++ Course / Strings / String Rbegin Function

String Rbegin Function

BLUF: Mastering String Rbegin Function is a critical step in becoming a proficient C++ developer. This lesson provides a deep dive into the syntax, performance considerations, and real-world applications of this concept.
Key Performance Insight: String Rbegin Function

C++ is renowned for its efficiency. Learn how String Rbegin Function enables low-level control and high-performance computing in the tutorial below.

C++ String rbegin

The rbegin method represents the reverse start. It is utilized to reference the final character within the string.

Syntax

Consider a string str. Syntax would be:

Example

reverse_iterator itr = str.rbegin();

Parameter

This function does not contain any parameter.

Return value

It yields the reverse iterator indicating the final character of the string.

Example

Let's see the simple example.

Example

#include<iostream>
using namespace std;
int main()
{
	string str="Dancing is my hobby";
	for(string::reverse_iterator itr=str.rbegin();itr!=str.rend();++itr)
	cout<<*itr;
	return 0;
}

Output:

Output

ybboh ym si gnicnaD

In this instance, we obtain the inverted string by utilizing the rbegin function.

Input Required

This code uses input(). Please provide values below:

Logic Practice
Install Logic Practice
Add to home screen for a faster app-like experience