Question 1
What will be the output of the following C program?
#include <stdio.h>
int main(void) {
int a = 5, b = 10, c = 15;
if (a = b == c)
printf("TRUE %d", a);
else
printf("FALSE %d", a);
return 0;
}Detailed Solution
In 'a = b == c', equality operator '==' has higher precedence than assignment '='. 'b == c' (10 == 15) evaluates to 0. Then 0 is assigned to 'a'. The condition evaluates to 0 (false), executing the else branch and printing 'FALSE 0'.