C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
C++ String rend()The rend() function stands for reverse end. This function points to the first character of the string. Syntax
Consider a string 'str' and reverse iterator 'ritr'. Syntax would be: reverse_iterator ritr = str.rend(); Parameter
This function does not contain any parameter. Return valueIt returns a reverse iterator pointing to the beginning of the string. Example
Let's see the simple example.
#include<iostream>
using namespace std;
int main()
{
string str="Hello World";
for(string::reverse_iterator itr=str.rbegin();itr!=str.rend();++itr)
cout<<*itr;
return 0;
}
Output: dlroW olleH In this example, we get the reverse string using rend() function.
Next TopicC++ Strings
|