The behavior is undefined because there are no sequence points between increment operators .
Explaining why the code does what it does is a meaningless exercise. You should not write code with undefined behavior, even if it works for you.
To answer the question raised in the comments: it is true that the comma operator
source
share