c / beginner
Snippet
Relational Comparison Operators
Relational operators are used to compare two values. They return 1 if the condition is true and 0 if it is false.
snippet.c
1
int x = 10; int y = 20; int result = (x < y);
Breakdown
1
int result =
Declares an integer to store the result of the comparison.
2
(x < y);
Checks if x is less than y. Since 10 is less than 20, this evaluates to 1.