< C++ Programming < Programming Languages < C++ < Code < Keywords

The auto keyword is used to have the compiler infer the type of the variable which follows it from the RHS or from its declaration.

Example
auto a = 3;      // int
auto b = 4.5;    // double
auto p = &a;     // pointer
This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.