jeudi 5 mars 2015

What is the type of "auto var = {condition} ? 1 : 1.0" in C++11? Is it double or int?

In C++11 what are the types of x and y when I write this?



int main()
{
auto x = true ? 1 : 1.0;
auto y = false ? 1 : 1.0;
std::cout << x << endl;
std::cout << y << endl;
return 0;
}

Aucun commentaire:

Enregistrer un commentaire