Must we always use %f to printf a %d value, and %lf to take input by scanf ? Why format specifier %d or %i does not work for a double variable but %f works and print a float output of an integer variable?
Is it always safe to declare double and take input scanf with %lf and printf as %f?
My codes:
int main(void)
{
    double dnum = 7777;
    printf(" %f \n", dnum);
        return 0;
}
output is 7777.000000
int main(void)
{
    double dnum = 7777;
    printf(" %i \n", dnum);
        return 0;
}
Output is 0
int main(void)
{
    double dnum = 7777;
    printf(" %d \n", dnum);
        return 0;
}
Output is 0
 
     
     
     
     
     
    