It is clear that this condition can be rewritten better, but your problem is observed due to the priority of the = and ?: Operators.
The assignment operator ?: Has a higher priority than = , therefore the expression
( i > j ) ? k = i : k = j;
Is equivalent
(( i > j ) ? k = i : k) = j;
This is not true because you cannot assign the result of an expression.
Actually this case is similar (( i > j ) : i : j) = 10; which is also incorrect.
source share