after the operation, b should equal to 5, then be should post decrement resulting b = 5, can anyone explain why this is not happening?
#include <stdio.h>
void main()
{
int a =2, b=3;
b=a++ + b--;
printf("a=%d b=%d\n", a, b);
}
after the operation, b should equal to 5, then be should post decrement resulting b = 5, can anyone explain why this is not happening?
#include <stdio.h>
void main()
{
int a =2, b=3;
b=a++ + b--;
printf("a=%d b=%d\n", a, b);
}
you are attempting to change b
twice in the same expression
b = <something>; // change b
/* b-- */ // change b
The order of the changes is not specified.