Which operator is used to compare two values for equality in C?

Which operator is used to compare two values for equality in C?

a) ==
b) =
c) !=
d) >>

Answer:

a) ==

Explanation:

In C, the == operator is used to compare two values for equality. It returns true if the values are equal and false otherwise. This operator is commonly used in conditional statements, such as if and while, to control the flow of the program based on comparisons.

Understanding how to use the == operator correctly is fundamental for making comparisons and decisions in your C programs.

Reference links:

https://www.rameshfadatare.com/learn-c-programming/

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top