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
What is modifier & how many types of modifiers available in c?
How to establish connection with oracle database software from c language?
Explain what are header files and explain what are its uses in c programming?
What are the properties of union in c?
Explain how does flowchart help in writing a program?
How to Throw some light on the splay trees?
Can I use base-2 constants (something like 0b101010)? Is there a printf format for binary?
What is void pointers in c?
write a program to input 10 strings and compare without using strcmp() function. If the character of one string matches with the characters of another string , sort them and make it a single string ??? example:- str1="Aakash" st2="Himanshu" str="Uday" output:- Aakashimanshuday (please post the answer as quickly as possible)
What is the auto keyword good for?
Is array a primitive data type in c?
application areas a 'c' a) operating system b) graphics, interpreter, assembler c) program evalution, communication softwares d) all the above
Draw a flowchart to produce a printed list of all the students over the age of 20 in a class .The input records contains the name and age of students. Assume a sentinel value of 99 for the age field of the trailer record
What is a far pointer in c?
Explain the use of bit fieild.