C++ string iterator Decrementing

Description

C++ string iterator Decrementing

#include <iostream> 
#include <string> 

using namespace std; 

int main(int argc, char *argv [])
{   //from   w ww.  j  av a 2 s  . c  om
        string myString{ "This is my string!" }; 


        for (string::iterator iter = myString.end()-1; iter != myString.begin(); --iter) 
        { 
                cout << *iter << endl; 
        } 
        return 0; 
}



PreviousNext

Related