This post explains the use of auto which can save lot of time during programming contest.
When a variable is defined as auto, compiler determines its type during compile-time. This is because when a new variable is initialized, the compiler can figure out what the type of the variable is automatically by the initializer. For this, it suffices to use auto as the type specifier for the variable: For example,
auto a = 1; // a will become 'int' auto b = 1LL; // b will become 'long long' auto c = 1.0; // c will become 'double' auto d = "variable"; // d will become 'string'
Happy Coding …
N.B. These are C++11 and above features, which is supported by all major online judges. Will not work for earlier versions.
To know more use this site link text