it is a type of data type? is it compatible with all other primitive data types or is it just a data type for address?
What is auto and how does it work?
@f20180123 The auto keyword specifies that the type of the variable that is begin declared will automatically be deduced from its initializer and for functions if their return type is auto then that will be evaluated by return type expression at runtime. It is not datatype.It is compatiblewith all primitive data types.
Eg.#include
#incllude
using namespace std;
int main() {
vector vec(10); // Auto deduce type to be iterator of a vector of ints.
for(auto it = vec.begin(); it != vec.end(); vec ++)
{
cin >> *it;
}
return 0;
}
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.