473,910 Members | 6,229 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

What is BOOL datatype in C99

AmberJain
884 Recognized Expert Contributor
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 10816
weaknessforcats
9,208 Recognized Expert Moderator Expert
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 Recognized Expert Contributor
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 Recognized Expert Moderator Expert
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 Recognized Expert Contributor
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 Recognized Expert Moderator Expert
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 Recognized Expert Moderator Expert
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 Recognized Expert Contributor
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 Recognized Expert Contributor
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 Recognized Expert Moderator Expert
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

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

Similar topics

2
1582
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 System.TypeCode). My job is to verify that the item really is a valid bool value, int, single, whatever Not quite seeing what i want in reflection. Thought the various datatype ..Parse methods would work but not directly. Maybe i could try Parse...
8
1957
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 extra thing to. The datatype is a class I made. Is there anyway for me to test a parameters datatype in a template using function?
1
1465
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. After that I am calling the update()- method on my DB-adapter-object ('adapter.Update(dbItems)') -- and I get an Exception... I've tried various values like true, "true", 1, "1". But it's the same problem everytime... Does anybody know that problem...
4
2195
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 those bits back into the checkboxes when the database is queried. Thanks for any help on this. Harry
3
3581
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 field other than boolean the "command" version of adding a field works great. But if I try to add a boolean field, I get an exception error when its trying to be added, so instead I have to use the function meathod. -Code is below.
7
7091
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 defined as boolean isOkay(string var) { ... some code ...
0
1355
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) parameterUserType.Direction = ParameterDirection.Output ObjCommand.Parameters.Add(parameterUserType) ObjCommand.ExecuteNonQuery()
2
20079
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
1946
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 njsokalski@hotmail.com http://www.nathansokalski.com/
0
9879
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
11055
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10541
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
8099
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7250
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5939
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6142
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4337
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3360
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.