main()
{
float a=8.8;
double b=8.8;
if(a==b)
printf("Equal");
else
printf("not equal");
getch();
}
what is the output?
with reason

Answer Posted / vignesh1988i

here it will print : either NOT EQUAL or EQUAL
according to me and my compailer it's NOT EQUAL only.......
depends upon the compailer actually......

here variable 'a' is assigned wit float and 'b' is assigned
with double....
here comes the problem ie. of allocation of no. of bytes

according to my compailer float allocates 4 bytes and double
allocates 8 bytes.... so when it compares each location bit
by bit the float will lag by two bytes of space than double
has .. so since the comparsion takes a decision tat it's not
equal since it dosent check the other two locations of
double wit float which is lagging wit that two bytes of
memory space....... so it prints NOT EQUAL


thank you

Is This Answer Correct ?    19 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the size of enum in bytes?

574


Explain enumerated types.

592


What is #define used for in c?

603


Why isnt any of this standardized in c?

624


What is static memory allocation? Explain

623






What should malloc() do?

631


Why static is used in c?

611


i have to apply for rbi before that i need to know the the syllabus for the entrance questions. whethet it may be aps or techinical

1829


How the c program is executed?

622


What is the use of #include in c?

568


Can a function argument have default value?

656


What is calloc in c?

652


What are the modifiers available in c programming language?

721


When is a null pointer used?

626


A SIMPLE PROGRAM OF GRAPHICS AND THEIR OUTPUT I WANT SEE WAHAT OUTOUT OF GRAPHICS PROGRAM

1689