When you will go definition of printf. A sample of it..
Code:
int printf( . . . )
{
//Some code
...........
...............
//va_arg : taking conversion symbol(%d, %f etc) and associated with values
switch( TYPE)
{
//Case INT_TYPE : Some code for Integer
// Case FLOAT_TYPE : some code for Float
// Case CHAR_TYPE : some code for char
......
.....
}
return ;
}
when conversion sybol(%d) and value is double then it's value will be junk. because printf function does not check for type casting. Just %d and its associated values. If it's matching then it will go correct switch case and correct value. Else wrong switch case will execute and value will be junk.