0
What is auto in c++
What is auto. I don't know. I really want to learn this. Help guys
3 Respostas
+ 2
Kaung Set Min Soe
An 'auto' is a type of storage class which describes about the visibility, life time ,and default value of a variable.
In c++ by default storage class of a variable is 'auto'
for example :
int x=10;
can be written as
auto int x=10;
Here if we don't intialize 'x' with 10
then
it will store any garbage value.
there are some other storage classes are available in c++ like static, extern, register, ......
+ 2
Automatic type deduction
http://en.cppreference.com/w/cpp/language/auto
0
I don't understand why this question has 1 down vote, what's auto is not told to us at sololearn
i would describe auto as automatic variable . Use it when you don't want to spend time by looking for what's output of some function. What it does is simply try to replace itself with correct type when you compile your program. Also used with arrays in for (auto i : arr)