468,457 Members | 1,686 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,457 developers. It's quick & easy.

What is BOOL datatype in C99

AmberJain
884 Expert 512MB
What is BOOL datatype in ANSI C99? I expect it to be related with BOOLEAN.
I searched internet for it but ended with information of no use.
Looking for an detailed description of BOOL................


__________________________________________________ _______________
Is there any ANSI C99 based compiler for download from internet?


THANKS.........
Feb 22 '08 #1
10 10376
weaknessforcats
9,207 Expert Mod 8TB
Let me know what you find out. I thought BOOL was a Microsoft typedef of an unsigned int. You were you test it a TRUE or FALSE since it could contain numbers other than 0 or 1.

FALSE is:

#define FALSE 0

and TRUE is:

#define TRUE !FALSE
Feb 22 '08 #2
AmberJain
884 Expert 512MB
Let me know what you find out. I thought BOOL was a Microsoft typedef of an unsigned int. You were you test it a TRUE or FALSE since it could contain numbers other than 0 or 1.

FALSE is:

#define FALSE 0

and TRUE is:

#define TRUE !FALSE
I'm presently referring to the book-------->

Computer Fundamentals and Programming in C
By : PRADIP DEY and MANAS ghosh
OXFORD university press

In this book, on page-205 , it is mentioned that-
__________________________________________________ _______________
"A complete list of possible data types is as:

bool (according to C99)
char
unsigned char
signed char
int
unsigned int
signed int
short int
unsigned short int
signed short int
long int
signed long int
unsigned long int
float
double
long double
__________________________________________________ _______________

I couldnot find (probably) anything else about it in that book as it is based on ANSI C89 (probably).
That's it. All that I know about BOOL presently is this. Any help in this matter is welcomed.............

~~THANKS~~
Feb 23 '08 #3
weaknessforcats
9,207 Expert Mod 8TB
There is a difference between BOOL and bool. I mean, a visual difference.

In C++ bool is a type that contains true or false:
Expand|Select|Wrap|Line Numbers
  1. bool var = true;
  2.  
  3. if (var == false)
  4. {
  5. etc....
  6.  
Feb 23 '08 #4
AmberJain
884 Expert 512MB
There is a difference between BOOL and bool. I mean, a visual difference.

In C++ bool is a type that contains true or false:
Expand|Select|Wrap|Line Numbers
  1. bool var = true;
  2.  
  3. if (var == false)
  4. {
  5. etc....
  6.  
__________________________________________________ _______________
That's fine........
But I need to ask two things :
1. Whether bool datatype works in C (not C++) or not.
2. Whether bool datatype works fine even with ANSI C89 compilers.

THANKS
Feb 24 '08 #5
weaknessforcats
9,207 Expert Mod 8TB
bool does not exist in C89 as a datatype.

That's why the BOOL macro exists.

I don't know about C99. Did you try it??
Feb 24 '08 #6
Banfa
9,051 Expert Mod 8TB
The bool type is in the C99 standard (copied from C++) and I would hope by now most C99 compilers support it (back in 2001-2002 many supposedly C99 compilers didn't).

Surprisingly C99 is not terribly popular, if a project is written in C as opposed to C++ then it tends to be C89 still.
Feb 25 '08 #7
AmberJain
884 Expert 512MB
bool does not exist in C89 as a datatype.

That's why the BOOL macro exists.

I don't know about C99. Did you try it??
__________________________________________________ _______________
Thanks..........................
No, I didn't tried it. I'm a student and am still learning C programming (let me tell you that I don't know still to program in C++). I'm using a C89 compiler. I just encountered it (the term "bool") in the book I mentioned above and just out of curiosity I posted this question.

THANKS ONCE AGAIN..........
Feb 25 '08 #8
AmberJain
884 Expert 512MB
The bool type is in the C99 standard (copied from C++) and I would hope by now most C99 compilers support it (back in 2001-2002 many supposedly C99 compilers didn't).

Surprisingly C99 is not terribly popular, if a project is written in C as opposed to C++ then it tends to be C89 still.
__________________________________________________ _______________
THANKS...........

Can you tell me the name (and download site) of a C99 based compiler.
Feb 25 '08 #9
Banfa
9,051 Expert Mod 8TB
Can you tell me the name (and download site) of a C99 based compiler.
I believe GNU g++ is C99 compatible with the correct compiler switches although there are some gaps in its implementation.

Microsoft does not have particular good support for C99, you can find more information on the Wikipedia C page
Feb 25 '08 #10
AmberJain
884 Expert 512MB
I believe GNU g++ is C99 compatible with the correct compiler switches although there are some gaps in its implementation.

Microsoft does not have particular good support for C99, you can find more information on the Wikipedia C page
THANKS....................
Feb 26 '08 #11

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by baylor | last post: by
8 posts views Thread by Eternally | last post: by
1 post views Thread by Georg Mayer | last post: by
4 posts views Thread by hari | last post: by
3 posts views Thread by Miro | last post: by
7 posts views Thread by Pep | last post: by
1 post views Thread by Nathan Sokalski | last post: by
reply views Thread by NPC403 | last post: by
1 post views Thread by subhajit12345 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.