?
Which operator is used to compare two values for equality in C?
Answer & Solution
Correct Answer:
Option
A
The operator used to compare two values for equality in C is Option A:
So, the correct answer is:
Option A:
Here's an example of using the equality operator in C:
In this example, the program checks if 'x' is equal to 'y' using the
==. The double equal sign (==) is the equality operator, and it is used to check if two values are equal to each other.So, the correct answer is:
Option A:
==Here's an example of using the equality operator in C:
int x = 5;
int y = 10;
if (x == y) {
// This condition will not be met because x is not equal to y
printf("x is equal to y");
} else {
printf("x is not equal to y"); // This will be printed
}
In this example, the program checks if 'x' is equal to 'y' using the
== operator and prints the result based on the comparison.
Join the Discussion
Login to post a comment or share your explanation.
Login