151k views
3 votes
In C++, && has a higher precedence than ||.
A. True.
B. False.

User AkaDrHouse
by
8.5k points

1 Answer

1 vote

Final answer:

In C++, the AND operator (&&) has higher precedence than the OR operator (||), meaning operations involving && are evaluated first in an expression.

Step-by-step explanation:

In C++, the logical AND operator (&&) does indeed have a higher precedence than the logical OR operator (||). This means that in an expression with both && and || without parentheses, the && operations will be evaluated first.

For example, in the expression cond1 && cond2 || cond3, the comparison cond1 && cond2 will be evaluated before cond3 is considered in relation to the entire expression.

User Rodrigo Quesada
by
8.8k points