Auto Keyword used in the loop

for( auto it=s.begin(); it!=s.end(); it++)

What is this auto keyword?

It is a keyword notifying the compiler to infer the type of the variable at compile time.
So in place of the datatype…when your write auto…it can handle any datatype

1 Like