1int foo = 0;
2auto bar = foo; // the same as: int bar = foo;
3// type of bar is the type of the value used to initialize it
1#include<iostream>
2#incllude<vector>
3using namespace std;
4
5int main() {
6 vector<int> vec(10); // Auto deduce type to be iterator of a vector of ints.
7 for(auto it = vec.begin(); it != vec.end(); vec ++)
8 {
9 cin >> *it;
10 }
11 return 0;
12}
1auto n=1;
2// this will make the type int, and you can't change trough the program;
3cout << n;
4// OR
5auto n="how you doin'";
6cout << n;