From the course: C Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Working with relational operators

Working with relational operators - C Tutorial

From the course: C Essential Training

Start my 1-month free trial

Working with relational operators

- [Instructor] Relational operators are used in C, to compare two values or expressions. These should be familiar to you. Less than, greater than, less than or equal to, greater than or equal to. And of course is equal to and not equal to, which you might not be familiar with. These two must go in this order with the equal sign coming last. The equal operator is used for comparison. This is why I call this comparison, is equal to and not equal. The single equal sign is the assignment operator, big difference. And finally not equal, the exclamation point in programming reads as not. These operators are often coupled with a keyword, such as, if, while and for. The keyword uses the comparison to alter program flow. The expression evaluates either true or false to control program flow. In this code, the if statement at line nine, compares the value input stored in variable A with a value 10. If this expression…

Contents