What is the output of the following C program?
#include <stdio.h>
int main(void) {
int x = 0;
if (x = 5)
printf("yes %d\n", x);
else
printf("no %d\n", x);
return 0;
}
x = 5 stores 5 in x and evaluates to 5, which is true. The comparison x == 5 was probably intended – compilers warn about this line.