Logical Operators in C

前端 未结 8 2030
说谎
说谎 2020-11-27 08:25

I am having trouble trying to understand how logical operators work in C. I already understand how the bit-level operators work, and I also know that logical operators treat

8条回答
  •  失恋的感觉
    2020-11-27 09:10

    C defines values greater than zero to be "True". As both 0x65 and 0x55 match this condition, the result is also True - which, on output, is 1 - or, in hex notation, 0x01.

    An alternative style of writing for your code would be:

    return (0x65 is true) and (0x55 is true);

提交回复
热议问题