Can someone explain how the following code functions
#include <stdio.h>
void main() {
int a = 2, b = -1, c = 0, d;
d = a-- || b++ && c++;
printf("%d%d%d%d", a, b, c, d);
}
I was expecting the value to be 1010
since I have read that &&
has more priority than ||
, hence it should be evaluated first. But the answer seems to be 1-101
. Could someone explain why? I know about the short circuit evaluation rule, but just don't understand why b++ && c++
isn't performed first?