anyone teach me about boolean function in C program... give me any one example program
Printable View
anyone teach me about boolean function in C program... give me any one example program
What do you want to understand?
C doesn't have a "boolean type", so I presume you are referring to boolean operators, which would be the:
&& operator
|| operator
and
! operator.
Some or all of those are likely to appear in any application of some complexity, e.g. anything a bit more complex than "Hello World" [actually they are probably part of that too, as I expect printf() to use them - but you can't see that in usual builds].
--
Mats
maybe you mean the type "_Bool" and "bool"?
_Bool can only have value 0 and 1. 0 = neg and 1 = positive.
bool needs you include the <stdbool.h> and a variable of type bool can have the value "true" and "false".
But just use _Bool and don't include anything.
I have no idea if it's optional or is C standard. But that worked with all compilers I used. (all recent)
Just checked the pdf linked in the pinned thread and apparently both _Bool and bool are C standard.