we cannot put assignment in the statement of ternary operator?
We perfectly could, You just needed to write (a < f) ? b = 1 : (b = 0); It's because the C compiler reads it like this: ((a < f) ? b = 1 : b) = 0; look at this post for more: https://stackoverflow.com/questions/17406503/ternary-operator-and-assignment-operator But in your case follow what Trisha said it way better.
Обсуждают сегодня