Vidyalelo
C Programming · Q7

C Fundamentals

Programming · C Programming · question 7

Q7

Which operator is used for 'logical AND' in C?

A.
&&
Answer
B.
||
C.
&
D.
|

Answer: Option A

Solution

Answer: Option A
Solution:
The operator used for 'logical AND' in C is Option A: &&. The && operator is used to perform a logical AND operation, which returns true if both of its operands are true, and false otherwise.

So, the correct answer is:
Option A: &&

Here's an example of using the logical AND operator in C:

if (x && y) {
// Code to be executed if both x and y are true
}

In this example, the code within the if statement will be executed only if both 'x' and 'y' are true.