Jump to content

C++ Language/Type/Shortcuts/FromInitialization

From Wikibooks, open books for an open world

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)