+ 2
Predict output?
#include<stdio.h> void main() { int a=3,b=2; a=a==b==0; printf("%d,%d",a,b); }
2 Answers
+ 3
a=a==b => a=false => a=0;
a=a==0 => a=true => a=1;
Output: 1,2
+ 2
As == is right to left associative, the output will be: a = 0, b = 2.
#include<stdio.h> void main() { int a=3,b=2; a=a==b==0; printf("%d,%d",a,b); }