Linked Questions
47 questions linked to/from Using Boolean values in C
7
votes
3
answers
18k
views
My linux's gcc compiler not supporting boolean values [duplicate]
I'm trying to make a function with return type as boolean...the syntax of the program seems to be correct but the compiler is giving errors....
The header files I've included are:
#include<stdio....
4
votes
3
answers
30k
views
‘true’ undeclared (first use in this function) in opencv [duplicate]
Possible Duplicate:
Using boolean values in C
I am newbie to C and want to write a program that will detect face from web cam, I got one on line,I am using opencv-2.4.3 on eclipse CDT, I searched ...
-3
votes
2
answers
2k
views
Implicit bool evaluation with if conditions [duplicate]
I have an integer called "count" which increments when a certain condition is met. So I wanted to ask what happens if you write this condition:
if(count % 2)
{
return even_bit;
}
else
{
...
-1
votes
1
answer
1k
views
|error: 'true' undeclared (first use in this function); did you mean 'free'?| [duplicate]
I'm trying to build a guessing game.
Hi, I'm trying to build a guessing game in C. But when I pass true in while loop in throws the following error:
error: 'true' undeclared (first use in this ...
-3
votes
1
answer
1k
views
How to return a boolean in C? [duplicate]
I'm trying to create a function which should return true or false if a given number complies with the given conditions. Anyway, it doesn't seem to work.
Here's the code:
bool conditions(int i) { ...
0
votes
0
answers
51
views
C Language program keeps getting bool and true and false as errors [duplicate]
I don't know what is wrong with the code but for some reason the C compiler keeps getting the bools of true and false and the bool itself in several errors. I have tried to fix the problems but my ...
98
votes
16
answers
315k
views
Using true and false in C
As far as I can see, there are three ways to use Booleans in C:
with the bool type, from <stdbool.h> then using true and false
defining using preprocessor #define FALSE 0 ... #define TRUE !(...
67
votes
10
answers
133k
views
Specifying size of enum type in C
Already read through this related question, but was looking for something a little more specific.
Is there a way to tell your compiler specifically how wide you want your enum to be?
If so, how do you ...
100
votes
2
answers
78k
views
What is the C99 _Bool data type and how do you use it?
What is the C99 _Bool data type and how do you use it?
41
votes
6
answers
179k
views
Which header file do you include to use bool type in C?
Here's all .h files I've included so far,but non have the definition of bool:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <...
41
votes
2
answers
277k
views
In c, in bool, true == 1 and false == 0?
Just to clarify I found similar answer but for C++, I'm kinda new to coding so I'm not sure whether it applies to C as well.
22
votes
4
answers
113k
views
What is the proper equivalent of "while(true)" in plain C?
Since C doesn't have bools, what is the proper variable to put in place of true in an algorithm that uses
do
{
// ...
} while(true);
???
Should a proper C programmer do
do
{
// ...
} ...
25
votes
3
answers
20k
views
Why use <stdbool.h> instead of _Bool?
Any time I had the need of a Boolean type I was told to either create one, or better yet, use stdbool.h.
Since stdbool.h uses typedef bool _Bool, is there a reason to use the header instead just ...
10
votes
6
answers
24k
views
What is bool in C/C++? A keyword or a macro?
I referred this question, in which some of the answers suggest that bool is an integral type (IDEs also treat it as a keyword).
However, none of the answers suggest the information provided in ...
8
votes
7
answers
20k
views
C or C++ Return Status
What are the best practices for writing C or C++ functions that return an int that represents a status code?
Specifically, I want to know about the client usage but other tips are welcome.
For ...