C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
C++ String rbegin()The rbegin() function stands for reverse beginning. This function is used to point to the last character of the string. SyntaxConsider a string str. Syntax would be: reverse_iterator itr = str.rbegin(); ParameterThis function does not contain any parameter. Return valueIt returns the reverse iterator pointing to the last character of the string. ExampleLet's see the simple 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: ybboh ym si gnicnaD In this example, we get the reverse string using rbegin() function.
Next TopicC++ Strings
|