For starters function main without parameters shall be declared like
int main( void )
In the first program the initialization expression can be represented like
int a = ( x && y ) || ( z++ );
According to the C Standard (6.5.14 Logical OR operator)
- ...If the first operand compares unequal to 0, the second operand is not
evaluated.
The first oerand ( x && y )
of the expression is equal to 0 because y is initialized by 0
int x = 1, y = 0, z = 5;
So the second operand ( z++ )
is evaluated.
As result z will be equal to 6.
In the second program the initialization expression can be represented the same way as in the first program
int a = ( x && y ) && ( z++ );
According to the C Standard (6.5.13 Logical AND operator)
- ...If the first operand compares equal to 0, the second operand is not
evaluated.
As before the first operand ( x && y )
of the expression is equal tp 0 and according to the quote the second operand ( z++ )
is not evaluated.
As result z will be equal to 5 as before.