For example in the code below
int x,y,z;
x=y=z=1;
z = ++x && ++y || ++z;
cout<<x<<y<<z;
The output is 2 2 1.
I guess it is because compiler knew that '++x && ++y' gives a 'true', so it skipped the remaining line || ++z
.
However, if I replace it with the code below:
z = ++x && ++y && ++z;
the output is still 2 2 1. shouldn't it be 2 2 2, because all parts of ANDs '++x' , '++y' , '++z' has to be evaluated.