Consider the following code:
float d = 3.14f;
int i = 1;
auto sum = d + i;
According to cppreference.com, i should be converte
It's rather simple really.
In old versions of C (before C99), you could write something like
auto n = 3;
and n would be an int type with the value 3. You could also write
auto n = 3.14f;
and n would still be an int type, with a value 3.
This was called implicit int and K & R made it quite famous.
So can you see that
auto sum = d + i;
merely assigns the float type d + i to sum which is an implicit int.
Hence the answer 4.
In newer versions of C (C99 onwards), implicit int was dropped.