What data type auto is

I could not understand this line of code

for (auto it = s.begin(); it != s.end(); it++)
{
cout << (*it) << “,”;
}

hello @udatta

auto is a keyword in c++, that automatically detects the datatype of data.

here s.begin() returns an iterator but we dont want to explicitly write its datatype so we have used auto keyword.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.