HOME | LAB PROGRAMMING | RATIONAL ROSE DIAGRAM | COMPUTE GRAPHICS | CLASS DIAGRAM | NETWORK PROGRAMING | BEST OF THE SITE

Float and double in c/c++

main()
{
float me=1.1;
double you=1.1;
if(me==you)
printf(“same”)
else
printf(“different”);
}
Tutorial answer:
different

Debugging solution:
Because int the floating point numbers cannot be predicted exactly. so if condition become false. and it is depends upon the bytes. Float take 4 bytes long double take 8 bytes

0 comments: