_Bool
|
data type that is not available in other C derivates (like C++)
Take a look at /usr/include/stdbool.h:
#define bool _Bool #define true 1 #define false 0 |
|
|
0 = false Any other value = true |
Example: the following if-statement will print "value is true"
if ( 1 )
printf("value is true\n"); /* Because 1 is not ZERO, so "true" */
else
printf("value is false\n");
|
How to run the program:
|
|
|
Compare operations | Meaning
---------------------+-----------------------------------------------------
x == y | returns 1 if x is equals to y, returns 0 otherwise
x != y | Not equal
x < y | Less than
x <= y | Less than or equal
x > y | Greater than
x >= y | Greater than or equal
|
|
Compare operations | Meaning
---------------------+-----------------------------------------------------
x && y | returns 1 if "x and y" is true, returns 0 otherwise
x || y | logical or
!x | logical not
|
How to run the program:
|