Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / C

Operator >= — greater than or equal to

The >= operator tests whether the left operand is greater than or equal to the right. It returns int: 1 or 0.

Version: C23; repository compiler flag, production runtime not attested

Syntax

left >= right

The expression left >= right includes equality, unlike left > right. Its result has type int: 1 means true and 0 means false. It can be used in an if condition.

For operands of real arithmetic types, the usual arithmetic conversions apply before comparison. Mixing signed and unsigned types can change the expected result. Complex types are not permitted.

Do not write a range as a >= b >= c: this means (a >= b) >= c. Use a >= b && b >= c. Pointer comparisons have separate restrictions; they do not order arbitrary addresses.

Examples

#include <stdio.h>

int main(void)
{
    int score = 70;
    int threshold = 70;

    printf("%d\n", score >= threshold);
    printf("%d\n", (threshold - 1) >= threshold);
    return 0;
}

Result

1
0

The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.

Sources