%d
actually is used for printing int
. Historically the d
stood for “decimal”, to contrast with o
for octal and x
for hexadecimal.
For printing double
you should use %e
, %f
or %g
.
Using the wrong format specifier causes undefined behaviour which means anything may happen, including unexpected results.
5
solved a is a double, printf(“%d”, a); works differently in IA32 and IA32-64 [closed]