When you do
int i = round(f*100);
you convert the result of the double round function. The converted result is stored in the variable int i , which can be used with the format "%i" because it expects an int argument.
When you pass the double result of round directly as an argument to the format that int expects, you have inappropriate formats and argument types. This leads to undefined behavior.
No conversion is performed in the printf call, and no conversion can be performed because the code inside the printf function does not know the actual type of the argument. All he knows is the format "%i" . All possible type information is lost for functions with a variable argument.
source share