Explain how this statement is evaluated: a = b = 2;
1 answer
In this statement, the value of 2 is assigned to both variables a and b at the same time. The statement is evaluated from right to left, starting with the value 2 being assigned to variable b first. Then, the value of variable b (which is now 2) is assigned to variable a. So, both variables a and b are now equal to 2.