void main() { signed x; unsigned y; x= 10 + - 10u + 10u + -10; y=x; if(x==y) printf("%d %d", x, y); else if(x!=y) printf("%u %u", x, y); }.
Which of the following is the output of the program?
-
Compilation error
-
0, 0
-
65536, 0
-
Runtime error
-
65536, - 10
B
Correct answer
Explanation
In any binary operation of dissimilar data type, lower data type operand always automatically type casted into the operand of higher data type before performing the operation and result will be higher data type.
x= 10 + (-10u) + 10u + (-10)
x= 10 + (-10) + 10 + (-10)
x=0 so y=0