i have been playing around with what would be considered valid C syntax and what wouldnt,
1<2<1 and to my surprise it is a valid C syntax, does anyone know what that would do or represent ?
i tried figuring it out by testing the value this kind of expressions take and changing the integer values but found no pattern.
In C, when using a relational operator such as
<, the result will always be
1 if the condition is true, or
0 if the condition is false.
Due to the rules on operator precedence and associativity, the expression
is equivalent to:
(1<2) is true, so it will evaluate to
1, so the entire expression is equivalent to:
Since this expression is false, it will evaluate to
1<2<1 is equivalent to writing