C++ for each loop with Constant Access on string value

Description

C++ for each loop with Constant Access on string value

#include <iostream> 
#include <string> 

using namespace std; 

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

        for (const char &letter : myString) 
        { 
                cout << letter << endl; 
        } 
        return 0; 
}



PreviousNext

Related