+ 9
If C doesnât have Boolean values, what is the alternative in situations that would normally require one?
6 Antworten
+ 15
Standard C (since C99) provides a boolean type, called _Bool . By including the header stdbool.h , one can use the more intuitive name bool and the constants true and false . ... Objective-C also has a separate Boolean data type BOOL , with possible values being YES or NO , equivalents of true and false respectively.
Initial implementations of the language C(1972) provided no Boolean type, and to this day Boolean values are commonly represented by integers ( int s) in C programs. The comparison operators ( > , == , etc.) are defined to return a signed integer ( int ) result, either 0 (for false) or 1 (for true).
+ 7
On one project, I've worked it was:
#define TRUE 1
#define FALSE 0
+ 5
bool works! as said by Abhi Varshini
https://code.sololearn.com/cS7jNLt09tRk/?ref=app
Isn't it bool? I mean cool đ
+ 2
Though C doesnât support Boolean value. But we can use Logical Operators like â&&â, â||â or â!â. We can do several logical program with these. If any one need some Fuzzy Logic boolean values, it can be modified by define preprocessors shaldem mention before..
- 1
Use 0 and 1
- 1
0 is false and 1 is true