i am posting codes and they give striking results can someone please explain why ???
[code=c]main()
{ float a=0.7 ;
if (a<0.7)
{ printf("c") ;
}
else
printf("c++") ;
}
[/code]OUTPUT is c
[code=c]main()
{ float a=0.7 ;
if (a<0.7f)
{ printf("c") ;
}
else
printf("c++") ;
} [/code]
OUTPUT : c++
WHY I know in the first case 0.7 is a double and second it is taken as a float ....so wht ???
[code=c]main()
{ float a=0.7 ;
if (a<0.7)
{ printf("c") ;
}
else
printf("c++") ;
}
[/code]OUTPUT is c
[code=c]main()
{ float a=0.7 ;
if (a<0.7f)
{ printf("c") ;
}
else
printf("c++") ;
} [/code]
OUTPUT : c++
WHY I know in the first case 0.7 is a double and second it is taken as a float ....so wht ???
Comment