Logical equality in C

Posted by andrew cooke on Stack Overflow See other posts from Stack Overflow or by andrew cooke
Published on 2012-06-08T16:35:23Z Indexed on 2012/06/08 16:40 UTC
Read the original article Hit count: 286

Filed under:
|
|

[It seems odd this doesn't exist, so apologies in advance if it's a duplicate]

I want to test for logical equality in C. In other words, I want to know whether two values would be equal if both were converted in the normal way associated with logical expressions.

In C99, I think that

(bool)a == (bool)b

gives what I want. Is that correct? What is the normal way of writing this in traditional C?

© Stack Overflow or respective owner

Related posts about c

    Related posts about boolean