k = (i = 4, j = 5);
printf("k = %d", k);
which gets the prcedence and how ?
k = 5
- Compiler told me.
- This is how comma operator works, namely: "[comma] is a binary operator that evaluates its first operand and discards the result, and then evaluates the second operand and returns this value (and type)" (see Comma operator at Wikipedia[^]).
Hence evaluation steps are:
i = 4 (discarded)
j = 5 (returned)
k = 5 (
k gets the returned value of the comma operator)
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)