Name: Anonymous 2015-07-31 22:48
#include <stdbool.h>
bool
or (bool a, bool b)
{
return a ? true : (b ? true : false);
}
bool
and (bool a, bool b)
{
return a ? (b ? true : false) : false;
}
bool
not (bool a)
{
return a ? false : true;
}
#include <iso646.h>
#include <stdbool.h>
#include <stdio.h>
int main(void)
{
bool one = true;
bool two = false;
printf("%d, %d, %d\n", (one or two), (one and two), (not one));
return 0;
}
$ gcc -o a a.c -std=c99 && ./a
1, 0, 0