Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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 void pointer? When is a void pointer used?

1107


How arrays can be passed to a user defined function

1069


What is the best way to comment out a section of code that contains comments?

1389


What are the types of type specifiers?

1096


What does static variable mean in c?

1144


a single linked list consists of nodes a to z .print the nodes in reverse order from z to a using recursion

2843


Write a program to print numbers from 1 to 100 without using loop in c?

1136


Where are some collections of useful code fragments and examples?

1196


What is volatile variable how do you declare it?

1186


What is merge sort in c?

1112


What is c basic?

1227


What is ambagious result in C? explain with an example.

2696


Why #include is used in c language?

1103


what is the role you expect in software industry?

2200


What Is The Difference Between Null And Void Pointer?

1334