1. ## Short circuit evaluation

I'm currently studying C and I'm having a hard time wrapping my head around how exactly short circuit evaluation works.
Two examples provided to me were:
Code:
```int a = 1, b = 1, c = -1;
c = --a && b--;
printf("%d %d %d", a, b, c);

a = 0, b = 0, c = -1;
c = a++ || ++b;
printf("%d %d %d", a, b, c);```
I know from my notes that the first evaluation returns 0 1 0
and the second evaluation returns 1 1 1. What I can't quite seem to get is why?

2. How are you on figuring out say
--a ; c = a && b;

The only tricky part is working out whether the RHS gets evaluated at all. If it doesn't, then the side effect doesn't happen either.

3. Originally Posted by Salem
How are you on figuring out say
--a ; c = a && b;

The only tricky part is working out whether the RHS gets evaluated at all. If it doesn't, then the side effect doesn't happen either.
So I think in that case 'a' would = 0, therefore c = 0 because the statement is false? I'm mostly confused by c = -1. So what I've been thinking is that -1 = 0 && 1
or
-1 = 0 || 1

I'm starting to think that the -1 has nothing to do with the evaluation.

4. It doesn't. Assignment will overwrite the previous value of the left hand side.

5. Now it makes perfect sense. Thank you!