If you're seeing this message, it means we're having trouble loading external resources on our website. If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.
We have discussed Introduction to Operators in C where we got an overall idea of what types of Operators, C and C++ support, and its basic implementations. Following that, we studied Arithmetic Operators where we got a detailed understanding of the types and use of Arithmetic operators in C and C++. In this article, let’s try to understand the types and uses of Relational and Logical Operators. Relational Operators Relational operators are used for the comparison of two values to understand the type of relationship a pair of number shares. For example, less than, greater than, equal to, etc. Let’s see them one by one
Examples:
Output: a is greater than b a is greater than or equal to b a is greater than or equal to b a is greater than b a and b are not equal a is not equal to b Logical Operators: They are used to combine two or more conditions/constraints or to complement the evaluation of the original condition under consideration. They are described below:
Examples:
Output: AND condition not satisfied a is greater than b OR c is equal to d a is not zero Short-Circuiting in Logical Operators:
Quiz on Operators in CThis article is contributed by Ayush Jaggi. Please write comments if you find anything incorrect, or if you want to share more information about the topic discussed above Article Tags : |