0

What is auto in c++

What is auto. I don't know. I really want to learn this. Help guys

26th Aug 2021, 6:44 AM
Kaung Set Min Soe
3 Antworten
+ 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, ......
26th Aug 2021, 7:11 AM
Bot
Bot - avatar
26th Aug 2021, 8:29 AM
Ipang
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)
26th Aug 2021, 4:19 PM
nicolas turek
nicolas turek - avatar