'Operator in C: not greater and equal to.

Just a fast question:

I'm trying to test if a variable is not greater than or equal to another variable.

I have it coded as such:

if (f!>=i){
print ("True");}

but my c compiler won't recognize it. I can't find it online, is it possible?



Solution 1:[1]

You want to do: if (!(f>=0))...

Specific to what you're doing, using < makes more sense. My suggestion here is just for a generic means of reversing polarity on any if statement.

Solution 2:[2]

Not greater than or equal to is equivalent to less than.

Solution 3:[3]

Use the aliter i.e instead of !> think in reverse and use f<i and you cant use ! for more than one operator i.e !+= is not valid

Solution 4:[4]

You can write it like so:

if(!(anyvariablename<0))

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 mah
Solution 2 Dan
Solution 3 Bhargav Rao
Solution 4 Jeremy W. Sherman