When I for instance write 7>1 in C (say C99 if this is not an always-been feature), can I expect the result will be exactly 1 or just some non-zero value? Does this hold for all bool operators?
When I for instance write 7>1 in C (say C99 if this is not
Share
In C99 §6.5.8 Relational Operators, item 6 (
<,>,<=and>=):As for equality operators, it’s a bit further in §6.5.9 (
==and!=):The logical AND and logical OR are yet a bit further in §6.5.13 (
&&)… and §6.5.14 (
||)And the semantics of the unary arithmetic operator
!are over at §6.5.3.3/4:Result type is
intacross the board, with0and1as possible values. (Unless I missed some.)