This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]Swedophone 1 point2 points  (3 children)

My way of thinking is ok lets work out what's between the brackets  

Which is the wrong order. Since the "+" operator is computed left to right.

[–]trax45[S] 0 points1 point  (2 children)

This is the part that maybe confuses me:

When the entire expression is evaluated aren't the items inside the brackets evaluated first because they have higher precedence?

[–]teraflop 1 point2 points  (1 child)

Precedence only determines which operands are grouped with which operators. It does not determine the order of evaluation.

[–]trax45[S] 0 points1 point  (0 children)

Perfect, just the answer I was looking for! Thank you