To avoid this, you can add a type conversion:
printf("%d ",pow( 10,2))-& gt; The output is 0
printf("%d ",(int)pow( 10,2))-& gt; The output is 100
This is related to the parameters of va_start/va_arg/va_end analysis variables. When printf encounters "%d", it uses int* type to get variables from the parameter list, while float/double is 8 bytes, so it only gets half -4 bytes.
See how floating point 100 is stored in memory:
00 00 00 00 59 40—Storage of floating point 100 in memory (16 hexadecimal, 8 bytes).
Take 4 bytes with int pointer and get 0.
And if we use cast to convert floating point into int, we can get the correct 100.