While variable initialization (i.e., declaration and assignment together) is considered a statement with no resulting value, variable assignment alone is an expression:
int i, j; // statement
i = 5; // both expression and statement
Normally, we rely on assignment for its side effects alone, but an assignment can be used
as a value in another part of an expression:
j = ( i = 5 );
Again, relying on order of evaluation extensively (in this case, using compound assignments
in complex expressions) can make code obscure and hard to read.
0 comments:
Post a Comment