1#include <iostream>
2using namespace std;
3int main(){
4 //Pointer declaration
5 int *p, var=101;
6
7 //Assignment
8 p = &var;
9
10 cout<<"Address of var: "<<&var<<endl;
11 cout<<"Address of var: "<<p<<endl;
12 cout<<"Address of p: "<<&p<<endl;
13 cout<<"Value of var: "<<*p;
14 return 0;
15}
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}