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 / pushkar pahare

This problem has different answers on different compilers.
I had used turboc3, where is always printf "not equal".
Because the size of float is 2 bytes and size of double is
4 bytes, So, when compiler checks this, it can only compare
two bytes rest are left un checked and thus it concludes
false condition. It is same on RHEL5 environment.

Where as on Visual Studio 6.0, It will yield "Equal",
because here both the float and double variable acquires
the same space in memory. Thus the compiler can compare all
four bytes of memory which in fact contains the same values
because the representation of value is same in float and in
double.

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are linker error?

1095


Explain a file operation in C with an example.

1121


Why does this code crash?

1100


Why is c used in embedded systems?

1124


What happens if a header file is included twice?

1037


program to convert a integer to string in c language'

2457


What is the g value paradox?

1173


Which one to choose from 'initialization lists' or 'assignment', for the use in the constructor?

1088


How is a pointer variable declared?

1098


An organised method of depicting the use of an area of computer memory used to signify the uses for different parts of the memory a) swap b) extended memory c) memory map d) all of the above

1184


What is pointer to pointer in c language?

1153


while initialization of array why we use a[][2] why not a[2][]...?

2365


How can I write a function that takes a format string and a variable number of arguments?

1057


int i=3; this declaration tells the C compiler to a) reserve space in memory to hold the integer value b) associate the name i with this memory location c) store the value 3 at this location d) all the above

1306


What is malloc calloc and realloc in c?

1335