Solution:
You need to remember, the assignment operator has lower precedence than &&
, so your condition is comparable as:
if ((match == 0 && k) = a)
But the left-hand side of this is an rvalue, namely the boolean resulting from the evaluation of the subexpression match == 0 && k
, so you cannot assign to it.
On the contrary, the comparison has higher precedence, so match == 0 && k == a
is comparable to:
if ((match == 0) && (k == a))
I hope you get the point now.