Logical Expressions in C misunderstanding

前端 未结 4 1503
不知归路
不知归路 2021-01-18 04:38

So, I was writing some code and I was getting an unexpected output in one part of my program which disrupted the entire system.

I managed to extract and simplify th

4条回答
  •  南方客
    南方客 (楼主)
    2021-01-18 04:57

    Operators precedence. && has higher precedence than ||.

    Your expression is the same as: ++i || (++j && k)

    ++i is TRUE, the parenthesis is not evaluated anymore.

提交回复
热议问题