473,224 Members | 1,900 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,224 software developers and data experts.

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 10775
weaknessforcats
9,208 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,208 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,208 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,065 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,065 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

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

Similar topics

2
by: baylor | last post by:
This is probably an easy question but i apparently can't find the right Google key words i am passed a string and the name of the data type i'm hoping that string is (technically, i'm passed a...
8
by: Eternally | last post by:
Hi folks, I've got a program which has a function which uses templates to accept parameters of any type. Works well, but there's one certain datatype which I want to special case and do an...
1
by: Georg Mayer | last post by:
Hi, I am trying to write a bool in an Access Database, where I have the datatype "true/false" (or "wahr/falsch" in German). I am using a DataSet, where I am doing my changes to the variable....
4
by: hari | last post by:
I am trying to enter the results of a checkbox into an MS SQL table.The checkbox returns a bool value that I want to place in the database as a bit. Or is there a better method? I need to read...
3
by: Miro | last post by:
Something weird I have run into when trying to add a boolean field to an Access table by code. -Just wondering if anyone else has run into this. ( vb.net 2005 express ) If I add any other...
7
by: Pep | last post by:
This is getting weird. I have to keep moving between visual c and gnu c++ compilers and now have come across a problem that seems to relate to the boolean datatype. I have a method that is...
0
by: Ayesharana | last post by:
the Following code is working in VB.net int UserType Dim parameterUserType As SqlParameter = New SqlParameter("@UserType", SqlDbType.BigInt, 8) ...
2
by: Jeff | last post by:
ASP.NET 2.0 I'm wondering what datatype in C# is the same as bit in SQL Server 2005?? Jeff
1
by: Nathan Sokalski | last post by:
When a DataTable is filled using something such as a DataAdapter, what values are assigned to each of the DataColumns' DataType property for the different SQL types? Thanks. -- Nathan Sokalski...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.