Hello all,
New user to C/C++ here and I have been going through the tutorials on this site to better understand it. I am confused by the following section though and am hoping someone will help me understand it.
Code:
A. !( 1 || 0 ) ANSWER: 0
B. !( 1 || 1 && 0 ) ANSWER: 0 (AND is evaluated before OR)
C. !( ( 1 || 0 ) && 0 ) ANSWER: 1 (Parenthesis are useful)
To specify, what I do understand is the operators themselves, but don't appreciate what is being performed in each of the above cases. Meaning, I am aware of how comparison operators can be used to check the value of variables, but why does the statement [NOT (1 OR 0)], by itself, return anything at all? I guess I'm confused as to why any of the above statements (A, B, or C) aren't completely useless, and why they conclude with a value. Hopefully that makes sense.
Thanks in advance for any help.