C++ auto inside for each loop
#include <iostream> #include <string> using namespace std; int main(int argc, char *argv []) { /*ww w. j a v a 2s . com*/ string myString{ "This is my string!" }; for (auto &letter : myString) { letter = 'a'; cout << letter << endl; } for (const auto &letter : myString) { cout << letter << endl; } return 0; }