R
Richard Bos
as ++j and ++k would first be evaluated and && operator applied to
obtain the result to be TRUE (3 && 1). Hence, ++i wouldn't be evaluated
as one part of || goes TRUE.
The ANSI C specification clearly states that && has precedence over ||.
The ISO C specification states no such thing, since "precedence" is
ambiguous.
What it _does_ state is this:
* To begin with, all logical operators are evaluated left-to-right, with
short-circuit evaluation. This means that it's possible to do this:
if (ptr!=NULL && *ptr!='A') ...
and be certain that your pointer is tested before being dereferenced.
* The logical and (&&) operator binds more closely than the logical or
(||). That is, x || y && z means x || (y && z), not (x || y) && z. The
order of evaluation remains the same, however.
Richard