CKTIS / C
Inequality operator !=
The != operator tests whether operands are unequal. It returns an int value: 1 for inequality and 0 for equality.
Version: C23; repository compiler flag, production runtime not attested
Syntax
left != rightleft != right returns 1 when the operands are unequal, or 0 when they are equal. The result has type int, not bool. The == operator tests the opposite relation.
Arithmetic operands undergo the usual arithmetic conversions first. The operator also supports permitted pointer comparisons, including comparisons with nullptr in C23. It does not compare string contents: pointer operands follow pointer equality rules.
In the example, left and right differ, whereas left equals itself.
Examples
#include <stdio.h>
int main(void)
{
int left = 4;
int right = 7;
printf("%d\n", left != right);
printf("%d\n", left != left);
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.