Which operator is used for 'logical AND' in C?
A. &&
B. ||
C. &
D. |
Answer: Option A
Solution(By Examveda Team)
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.
Related Questions on C Fundamentals
What is the primary purpose of a function prototype in C?
A. Declare a variable
B. Declare a function
C. Define a function
D. Assign a value
What is the correct syntax for declaring a variable in C?
A. int variable_name;
B. variable_name = 5;
C. variable_name int;
D. int = variable_name;
Join The Discussion