Jasmeet Singh
Jasmeet Singh

Reputation: 103

what is for(auto& x : s) in C++

Since I am new to C++, I do not know what the expression means?

and how can i co-relate this expression with C language.

                           #include <bits/stdc++.h>
                           using namespace std;
                           int main()
                           {

                              // string to be converted to lowercase
                              string s = "GEEKSFORGEEKS";

                              for (auto& x : s) {
                          x = tolower(x);
                              }

                                cout << s;
                                return 0;
                             }

Upvotes: 0

Views: 171

Answers (0)

Related Questions