What is the point of the logical operators in C?

后端 未结 5 1995
被撕碎了的回忆
被撕碎了的回忆 2020-12-18 07:49

I was just wondering if there is an XOR logical operator in C (something like && for AND but for XOR). I know I can split an XOR into ANDs, NOTs and ORs but a simple

5条回答
  •  一整个雨季
    2020-12-18 08:12

    Bitwise XOR does not work as would a logical XOR when its operands are integer values:

    2^4 ? "Valid" : "Invalid"
    

    gives "Valid" but should give "Invalid"

提交回复
热议问题