Discussion :: C-MCQs
-
Comment on the output of this C code?
int main()
{
float f1 = 0.1;
if (f1 == 0.1)
printf("equal\n");
else
printf("not equal\n");
}
Answer : Option B
Explanation :
0.1 by default is of type double which has different representation than float resulting in inequality even after conversion.
Output:
$ cc pgm4.c
$ a.out
not equal
Be The First To Comment