C++ Language/Type/Shortcuts/FromInitialization
The compiler can infer a variable's type from its initialization data.
So defining auto iVar = 11;
is the same as defining int iVar = 11;
(because 11
is a int
literal).
Additional information about inferring type from initialization data (includes interactive examples)