Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C Programming
Can anyone help me with this "if" condition please?
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Keith Thompson, post: 3783558"] [i] [...] I'm going to take issue with your use of the word "the". Any scalar expression with the value 0 is false when used in a context that requires a condtion. *Any* non-zero value is true. The equality and relational operators happen to be guaranteed to yield the value 1 when the condition is true (likewise for "&&" and "||"); the code we're disucssion takes advantage of that fact. Other operations that yield conditions might yield any arbitrary non-zero value when the condition is true. For example, this: if ((x <= y) == isdigit(z)) won't necessarily work, since isdigit() can return any non-zero value when z is a digit; both conditions could be true, but (0 == 42) is false. (If C had a real Boolean type *and used it consistently for conditions*, this might not be an issue.)[/i] [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C Programming
Can anyone help me with this "if" condition please?
Top