as far as i know all && will be evaluated first(from left to right) and then all || will be evaluated (from left to right) but it is not like this as seen by the output.
please clarify me.
Joined: Jun 06, 2005
Please note that the values substitution takes place from Left to right without bothering about operators. The operators come into picture only after the value substitution phase. So initially you should not be bothered about operators when expressions are evaluated.
Now the expression you gave is ( ((a=true) && (b=true)) || ((c=true)&&(d=true)&&(e=true)) || (f=true) )
As I said the substitution takes place from left to right .(Even this is a bit tricky since the operators are short ciruicted)
After this step a=true is assigned. Note that true && something = something. so the first expression must still be evaluated
Step 2 ( ((true) && (true)) || ((c=true)&&(d=true)&&(e=true)) || (f=true) ) After this step b=true is assigned. Now we are left with (true) || something1 || something2. As || is short circuited something1 and something2 need not be evaluated and the expression is always true
So the values are a=true b=true and the rest have default value false.
Joined: Feb 07, 2005
i have added single commented to your code.Check this comment and try to understand what is comment is indicating.