C++ examples for STL:string
Move backward through a string from end to beginning via string::reverse_iterator
#include <iostream> #include <string> using namespace std; int main(int argc, char *argv []) { // ww w . ja va 2 s .c o m string myString{ "This is my string!" }; for (string::reverse_iterator iter = myString.rbegin(); iter != myString.rend(); ++iter) { cout << *iter << endl; } return 0; }