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
I have written a pro*C program to fetch data from the cursor. where in i have used the concept of BULK FETCH.... each FETCH statement is taking lots of time to fetch specified number of rows at...
What does. int *x[](); means ?
What is bin sh c?
How can you return multiple values from a function?
What is the use of static variable in c?
What is "Duff's Device"?
Lists the benefits of c programming language?
How do you define structure?
Difference between Function to pointer and pointer to function
What is #define?
This is a variation of the call_me function in the previous question:call_me (myvar)int *myvar;{ *myvar += 5; }The correct way to call this function from main() will be a) call_me(myvar) b) call_me(*myvar) c) call_me(&myvar) d) expanded memory
Write a programme using structure that create a record of students. The user allow to add a record and delete a record and also show the records in ascending order.
find the sum of two matrices and WAP for it.
Define recursion in c.
What is the difference between struct and union in C?