To make life easier, C gives us a bunch of logical operators which work between operands. These work like +, -, * or / but they produce either 0 or 1 as a result depending on whether or not the result of the logical expression is true or false. For example:

counter < 99

The operator < means "less than". When the compiler sees this it says "Aha, you want me to compare these two operands and return true (i.e. a non-zero value) if the comparison is true". In this case the result would be true if (and only if) the value in the variable counter is less than 99. Note that this means that if counter contains 99 the condition will not be true as it is not less than 99.

There is a complementary > (greater than) operator. If you have difficulty remembering which is which, I keep in mind that the < looks a bit like an L, which means less than.

Note that this means you can write meaningless things like:

100 > 10

The compiler will quite happily compile this, and generate a result which is always true because the constant 100 is always bigger than the constant 10. Some programmers use the value 1 to mean always true. This can be put into loops (of which more later) so that the loop never stops.

If we want to check less than or equal we can use <=. For greater than or equal we use >=.

On the right you can see a CPIC with a couple of conditions in it. Run the program and convince yourself that the conditions used make sense. Remember that if two numbers are equal the greater than or less than operators will fail.