What is auto keyword in C++? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

What is auto keyword in C++?

What is its functionality?

14th Mar 2019, 4:48 AM
Anshuman Sethia
Anshuman Sethia - avatar
2 Answers
+ 6
https://en.cppreference.com/w/cpp/language/auto Type deduction during initialization. The 'auto' keyword tells the compiler to deduce the type of a variable from its initialization expression. How is it useful? Instead of doing std::vector<std::vector<std::string>> obj = new std::vector<std::vector<std::string>>; you can now do auto obj = new std::vector<std::vector<std::string>>();
14th Mar 2019, 5:03 AM
Fermi
Fermi - avatar
+ 3
Thanks for helping
14th Mar 2019, 5:14 AM
Anshuman Sethia
Anshuman Sethia - avatar