473,396 Members | 2,129 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,396 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 10788
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.