int x;
x= a>b>c;
// Compiler, pops 0
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
VulpesRank #55 · 29.2K reputationPosted Oct 9, 2014, 2:18 AM EDT
Sometimes it will return 1; for example if a =2, b = 1, c = 0.
It's executed as if it were written:
x = (a > b) > c;
The bracketed expression returns 1 (for true) if a > b or 0 (for false) if a <= b.
This result is then compared with c using the same principles.
So for the above values of a, b and c, we have:
2 > 1 => true => returns 1
1 > 0 => true => returns 1
If we'd had a = 0, b = 1, c = 2, the result would have been 0 as follows:
0 > 1 => false => returns 0
0 > 2 => false => returns 0
Munesh SharmaRank #174 · 13.9K reputationPosted Oct 9, 2014, 2:21 AM EDT
you also have to assign datatype for a,b,c
this expression will start from left side.
Vipul explain it better by using a example
u can understand batter these expression type question from this site
http://www.indiabix.com/c-programming/expressions/