In C ++ or C:
True - 1 or any nonzero value
False - 0 or any negative value
These conditions are short-circuited - therefore, when C ++ / C encounters the first true part - it breaks and does not evaluate the rest.
x = y = z = 1; ++x || ++y && ++z; printf ("x = %d\ty = %d\tz = %d\n", x, y, z); //op : x = 2 y = 1 z = 1 //why is 'x' only incrementd?
x is true (2) and the rest of the condition is not evaluated
x = y = z = -1; ++x || ++y && ++z; printf ("x = %d\ty = %d\tz = %d\n", x, y, z); //op : x = 0 y = 0 z = -1 //why are 'x' and 'y' incremented?
x is false (0), so a calculation of y that is false (0) is performed - since it is false, it is not yet verified further.
x = y = z = 1; ++x && ++y || ++z; printf ("x = %d\ty = %d\tz = %d\n", x, y, z); //op : x = 2 y = 2 z = 1 //why is 'x' only incrementd?
x is true (2, which is not equal to zero) y is true (2) - since x and y are true - the first part is true, therefore it does not evaluate z.
x = y = z = -1; ++x && ++y || ++z; printf ("x = %d\ty = %d\tz = %d\n", x, y, z); //op : x = 0 y = -1 z = 0 //why are 'x' and 'z' incremented?
evaluated as (x & y) || Z x is evaluated and false (0) z is then evaluated and false (0), the result of this condition is actually incorrect.
I may be completely wrong, but as I understand it. Hope this helps.