0

#include <stdio.h> int main() { int x=1?0:2?3:4; printf("%d",x); return 0; }

How?

9th Sep 2020, 5:12 AM
Rohit Ahuja
Rohit Ahuja - avatar
4 Réponses
+ 2
? Is ternary operator. Syntax: condition?if true: if false. Here x=1(true). 1?0:2?3:4. First Take 1?0:2 1 is also represents true. So the condition true. It Execute 0.
9th Sep 2020, 5:20 AM
Vadivelan
+ 1
coffeeunderrun I know what is ternary operator but I wanna say that after 0 what happen to the next ternary operator 0?3:4 it is not evaluated?
9th Sep 2020, 5:23 AM
Rohit Ahuja
Rohit Ahuja - avatar