How to read the expression (i = j) || (j = k)
I was practicing some exercise from the book, so I wrote down the program below.
Code:
#include<stdio.h>
int main(void)
{
int i = 7, j = 8, k = 9;
printf("%d ", (i = j) || (j = k));
printf("%d %d %d", i, j, k);
getch();
return 0;
}
The result should be 1 8 8 9, but I don't know how this expression work.
How to interpret the expression (i = j) || (j = k)?
In the first parentheses (i = j), did the program assign 8 to i?
If so, why didn't it assign 9 to j as well, in the second parentheses (j = k)?
Later on, why the i remain as 8, when was it saved?