lundi 31 juillet 2017

Why the sum of an int and a float is an int?

float d = 3.14f;
int i = 1;
auto sum = d + i;

The sum is 4. Why does this happen?

According to cpp reference, int will be converted to float.

Aucun commentaire:

Enregistrer un commentaire