Printf MCQ 21 : sizeof (Float + int)
Printf Multiple Choice Questions 21 : sizeof(Float + int)
Predict the Output of the Following Program if Given Things are -
#include<stdio.h> void main() { int num1 = 10; float num2 = 20; printf("%d",sizeof(num1+num2)); }
Options :
- 2
- 4
- 30
- Garbage
[toggle title=”Output”]4[/toggle]
Switch to Printf MCQ Home : Click Here
How and Why ?
- Integer Can be Converted into Float i.e 20 can be written as 20.0
- Here Integer is Converted into Float
- Result of num1+num2 is Float
- Size of Float is 4 bytes