What does the ^ operator do to a BOOL?

后端 未结 7 1761
情深已故
情深已故 2021-01-23 04:10

What does this statement mean?

isChecked = isChecked ^ 1;

isChecked is a BOOL.

7条回答
  •  自闭症患者
    2021-01-23 04:33

    The "^" is an exclusive OR operation, so 0 flips to 1, and 1 flips to zero. The result should be the same as isChecked = !isChecked.

提交回复
热议问题