"auto" in C++

Before C++ 11 we had to mention the type of a variable while declaring it, but now we don't necessarily have to mention the type of the variable.
We can just use "auto" and when we initialize it with a value or a variable then it will automatically take the type of the value or variable.
#include<bits/stdc++.h>
using namespace std;
int main(){
int a = 5.4;
auto c=a;
cout<<typeid(c).name();
}
One thing to keep in mind when we are using auto is that the variable should be initialized at the time of declaration otherwise compiler will throw an error.




