First have a look at Operator Precedence.
Then, regarding the working of logical OR operator, from C11
, chapter ยง6.5.14 (emphasis mine)
[...] the ||
operator guarantees left-to-right evaluation; if the
second operand is evaluated, there is a sequence point between the evaluations of the first
and second operands. If the first operand compares unequal to 0, the second operand is
not evaluated.
and regarding the result:
The ||
operator shall yield 1
if either of its operands compare unequal to 0
; otherwise, it
yields 0
. The result has type int
.
So, in your code
d = ++c || ++a && ++b ;
is the same as
d = (++c) || (++a && ++b);
which evaluates to
d = 1 || (++a && ++b); // short circuit, RHS not evaluated
which is finally same as
d = 1; // 1 is not the value computation of `++c`, rather result of the `||` operation.