Programming in D – Solutions

Assignment and Order of Evaluation

The values of a, b, and c are printed on the right-hand side of each operation. The value that changes at every operation is highlighted:

at the beginning   →     a 1, b 2, c irrelevant
c = a              →     a 1, b 2, c 1
a = b              →     a 2, b 2, c 1
b = c              →     a 2, b 1, c 1

At the end, the values of a and b have been swapped.