Example 1 — Printing comparison results
Each comparison evaluates to 0 or 1.
#include <stdio.h>
int main(void) {
int x = 7, y = 10;
printf("x == y: %d\n", x == y);
printf("x != y: %d\n", x != y);
printf("x < y: %d\n", x < y);
printf("x >= y: %d\n", x >= y);
return 0;
} How It Works
x == yis false, so it prints0.x != yandx < yare true.- The results are plain integers, so they can be added or stored.
