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

Thảo Justin

New member
What will be the output of the following code given below?
Code:
void main() {
    int a = 0; 
    double d = 10.21;
    printf("%lu", sizeof(a + d));
}
void loop() {}
A. 23
B. null
C. 8
D. 10.21
 
Answer: C
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