why auto is used in the for loop? Can we solve it without using auto??
String class Iterator
@Ambuj-Singh-514796906079795
hello ambuj,
auto detects datatype automatically .
if u dont to use auto keyword then u need to define datatype explicitly.
for example if u want to iterate on string using iterator
then using auto u can do something
for(auto it = s.begin() ; it != s.end() ; it++)
without using auto
for( string::iterator it = s.begin(); it != s.end() ; it++)
1 Like
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.