No. In C, there is a sequence point between the && operator LHS estimate and the RHS estimate, and the increment must be performed and performed before the RHS estimate. Thus, i++ is executed (equivalent to i++ != 0 ), and the increment is completed (and the expression evaluates to true), therefore, by the time RHS is evaluated, i == 2 and, therefore, the general expression is false, and you will get “No”. If the &HS of the && operator evaluates to false (0), the RHS will not be evaluated due to the "short circuit" property of the && operator.
Only a few operators have the property of having a sequence point between the LHS and RHS ratings: && , || and , (as an operator, and not as a separator in the argument list) - and there ? : ? : also, which is not a binary operator, but has a sequence point after evaluating the condition and before evaluating the expression after ? or the expression after : (from which one or the other, but not both, are always evaluated).
Operators && and || are the only operators with the "short circuit" property. RHS && is evaluated only if LHS is evaluated as true; RHS || evaluated only if the LHS evaluates to false.
Point refinement
Iwillnotexist Idonotexist correctly approved :
The C11 standard did not do away with sequence points, only the C ++ 11 standard did.
C ++ 11 (ISO / IEC 14882: 2011) states:
1.9 Program Execution
¶13. The previously segmented segment is an asymmetric, transitive, pairwise relation between estimates made by one (1.10), which causes a partial order among these estimates. For any two evaluations, A and B, if A is sequenced to B, then the execution of A must precede the execution of B. If A is not sequenced to B and B is not sequenced to A, then A and B are not affected. [Note: Performing non-overlapping scores may overlap. -end note] Scores A and B are indefinitely sequenced when either A is sequenced before B or B is sequenced to A, but that is not indicated. [Note: vaguely sequenced estimates cannot overlap, but either can be performed first. -end note]
The term “sequence point” does not appear at all in C ++ 11 (the only match is “sequence pointer”).
C11 (ISO / IEC 9899: 2011) states:
5.1.2.3 program execution
¶3. The previously segmented segment is an asymmetric, transitive, pairwise relation between estimates performed by a single thread, which causes a partial order among these estimates. For any two evaluations, A and B, if A is sequenced before B, then the execution of A precedes the execution of B. (Conversely, if A is sequenced to B, then B is the sequence after A.) If A is not sequenced before or after B, then A and B are unsequenced. Scores A and B are indefinitely sequenced when A is sequenced either before or after B, but that is not indicated. 13) . The presence of a sequence point between the evaluation of expressions A and B implies that each calculation of the value and the side effect associated with A are sequenced before each value and the side effect associated with B. (A brief description of the points in the sequence is given in Appendix C.)
13) Performing non-referential estimates can alternate. Uncertainly ordered estimates cannot be interleaved, but can be performed in any order.
So, C11 retains the points of the sequence, but adds the “previously sequenced” and related terms, using essentially the same terminology as C ++ 11.