I'm wondering if someone can help explain why the following code snippet returns a and b both equal to 6.
int main(){
int a =5, b;
a++,b=a;
printf("%d %d\n", a, b);
}
Is the answer that, in fact, the behaviour is implementation-specific (based on compiler)? Or, is the following the explanation (my understanding of postfix is that the incrementing only happens after the variable a has been "used" by whatever other operator exists around it). In this case, is the a "used" by the comma operator when the LHS is evaluated and then thrown away, such that incrementing happens before the RHS is evaluated?
Thanks in advance!