4 ms·
I did initially, until I looked up [1] and changed it in the edit. I figure separating it is cleaner. [1] http://en.wikipedia.org/wiki/Comma_operator http://e
by alexgartrell 16y ago
I did initially, until I looked up [1] and changed it in the edit. I figure separating it is cleaner.
[1] http://en.wikipedia.org/wiki/Comma_operator http://en.wikipedia.org/wiki/Comma_operator
- vog 16y agoBut the combined expression solves exactly your problem! You were not sure whether the increment would always happen before the assignment. In the combined expression you can simply use the pre-increment operator, which will always increment before the rest of the expression. It's shorter, unambiguous and leaves less questions. How can something be any "cleaner" than that? Also, the statements "array[index++]" and "array[++index]" are pretty well-understood idioms in C.