Sail E0 Webinar
Question

What is the output of the following program?


#include<stdio.h>
void main()
{
printf("%d",sizeof(5.2));
}
Options:
A .  Compiler Error: Can't determine size of a constant
B .  4 (Size of float)
C .  8 (Size of double)
D .  Garbage Value
Answer: Option C

The default type for decimal constants is double and not float.


Hence the value 5.2 is treated as a double and 8 is printed.




Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers