What will be the output of the following code given below? [code] void main() { int a = 10; double d = 10.21; printf("%lu",

Trang Mắm

New member
What will be the output of the following code given below?
Code:
void main() { 
    int a = 10; 
    double d = 10.21;
    printf("%lu", sizeof(a + d));
}
A. 8
B. null
C. 9
D. 20.21
 
Answer: A
Explanation: The sizes of int and double are 4 and 8 respectively, a is an integer variable whereas d is a double variable. The final result will be a double in this case in order to keep the precision. Hence the output of the code is 8 bytes.
 

Tìm kiếm

Back
Top