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
Explain can the sizeof operator be used to tell the size of an array passed to a function?
Are pointers integer?
When a c file is executed there are many files that are automatically opened what are they files?
How macro execution is faster than function ?
What is the need of structure in c?
given post order,in order construct the corresponding binary tree
Define VARIABLE?
What is the difference between mpi and openmp?
Is c still used?
Can i use “int” data type to store the value 32768? Why?
Why is c used in embedded systems?
What are the types of data types and explain?
What are pointers? Why are they used?
Explain what is the heap?
How can I read in an object file and jump to locations in it?