What does y -= m < 3 mean?

后端 未结 8 2060
面向向阳花
面向向阳花 2021-01-30 20:03

While looking through some example C code, I came across this:

y -= m < 3;

What does this do? It it some kind of condensed for loop or som

8条回答
  •  旧时难觅i
    2021-01-30 20:45

    I can't tell you want it's for, but I can tell you what it does:

    m < 3 returns an int of 0 or 1 representing a boolean value.

    if m is less than 3, the statement evalutates as: y -= 1 or y = y - 1;

    if m is greater than or equal to 3, the statement evalutates as y -= 0 or y = y - 0. Overall in this case, the statement does nothing.

提交回复
热议问题