C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
C++ String crbegin()The crbegin() function stands for 'reverse beginning'. This function references to the last character of the string. SyntaxConsider a string str. Syntax would be: str.crbegin(); ParameterThis function does not contain any parameter. Return valueThis function returns the constant iterator pointing to the last character of the string. Example 1Let's see the simple example of crbegin() function: #include<iostream> using namespace std; int main() { string str =?Lotus Flower?; for(auto i=str.crbegin();i!=str.end();i++) { cout<<*I; } return 0; } Output: rewolF sutoL This example shows how to reverse the string using crbegin() function. Example 2#include<iostream> using namespace std; int main() { list<int> li(1,2,3,4,5); for(auto i =li.crbegin();i!=end();i++) { cout<<*i; } return 0; } Output: 54321 This example shows how to get the reverse list using crbegin() function.
Next TopicC++ Strings
|