+ 2

Predict output?

#include<stdio.h> void main() { int a=3,b=2; a=a==b==0; printf("%d,%d",a,b); }

6th Aug 2019, 7:04 PM
Rejith Retnan
Rejith Retnan - avatar
2 Réponses
+ 3
a=a==b => a=false => a=0; a=a==0 => a=true => a=1; Output: 1,2
6th Aug 2019, 7:38 PM
Solo
Solo - avatar
+ 2
As == is right to left associative, the output will be: a = 0, b = 2.
7th Aug 2019, 12:53 PM
Grizzly Gunner
Grizzly Gunner - avatar