asignment_operator

assignment_operator

Assignment is an operator not a statement, it returns a value. Assigment is right associative. i = j = k; := i = (j = k);

int i;
i = 72.99f // (returns 72)

compound assignment

As seen before, however we say that v += e is NOT equivalant to v = v + e. Pay attention to how many times v is called. For example

a[i++] += 2;
// as opposed to
a[i++] = a[i++] + 2;

This is due to order of precedence, as well as side_effects. They are also right associative, and can be chained. i += j += k; := i += (j += k); # standard wood

related

backlinks