It returns a reference to the last character of the string.
DeclarationFollowing is the declaration for std::string::back.
char& back();C++11
const char& back() const;Parameters
none
Return ValueIt returns a reference to the last character of the string.
Exceptionsif an exception is thrown, there are no changes in the string.
ExampleIn below example for std::string::back.
#include <iostream> #include <string> int main () { std::string str ("sairamkrishna mammahe."); str.back() = '!'; std::cout << str << '\n'; return 0; }
sairamkrishna mammahe!
string.htm
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4