Hey is their a standard library that gives false and true values or something or are you suppose to assign them?? Im writing a function that suppose to return true or false. And i also tried replacing the words true and false by !0 (true) and 0 (false) but my program gives me a weird segmentation fault with the replaced words and without. Could someone give me some advice?
speedy94519
0
Light Poster
Recommended Answers
Jump to Postwhy would you define TRUE as 0 and FALSE as 1?
TRUE and FALSE are defined, as 1 and 0 respectively, in stdbool.h for C99.
if you're unsure do this:
#ifndef FALSE #define FALSE (0) #endif #ifndef TRUE #define TRUE (1) #endif
Jump to Post>Could someone give me some advice?
Not without seeing any code, no. Your problem appears to be a runtime error more than confusion about true and false.>TRUE and FALSE are defined, as 1 and 0 respectively, in stdbool.h for C99.
They're both lower case, actually:
All 5 Replies
jephthah
1,888
Posting Maven
speedy94519
0
Light Poster
speedy94519
0
Light Poster
Narue
5,707
Bad Cop
Team Colleague
jephthah
1,888
Posting Maven
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.