+ 1

#include<stdio.h> void main() { int count=0?2:0?3:4?5:6?1:9; printf("%d", count); }

I want to know about how the answer came 5?

14th May 2020, 7:14 AM
Krupang Buddhdev
Krupang Buddhdev - avatar
2 Réponses
+ 8
0?2:0?3:4?5:6?1:9 is something like if (0) { return 2; } else { if (0) { return 3; } else { if (4) { return 5; } else { if (6) { return 1; } else { return 9; } } } } Trace it and you'll get 5.
14th May 2020, 11:04 AM
Hatsy Rei
Hatsy Rei - avatar