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 / sandy0103

I am NOT sure, if it is something to do with the compiler,
rather it is something to do with the precision. Float has
got single precision and double is double precision. This
precision difference will get different value when you see
raw value. In another sense, I tried debugging the program
in VS2005 debugger, and if we monitor the value using
watch, you can see for float it is taking the value
as "8.8000002" and for double, it is taking value as "
8.8000000000000007". And hence the precision plays a role
here.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is a NULL Pointer? Whether it is same as an uninitialized pointer?

745


What are the 4 types of unions?

596


Explain what is the most efficient way to store flag values?

687


What is #include in c?

587


Find MAXIMUM of three distinct integers using a single C statement

614






What is the general form of function in c?

605


Stimulate calculator using Switch-case-default statement for two numbers

2435


What are two dimensional arrays alternatively called as?

648


Explain Basic concepts of C language?

633


What does s c mean in text?

598


Are the outer parentheses in return statements really optional?

566


What standard functions are available to manipulate strings?

552


Explain how do you override a defined macro?

573


Take an MxN matrice from user and then sum upper diagonal in a variable and lower diagonal in a separate variables. Print the result

1457


Why do we need a structure?

574