Does C have a data type for boolean so i can do a boolean functions? If so, what library is it in?
Printable View
Does C have a data type for boolean so i can do a boolean functions? If so, what library is it in?
Yes, as of C99, but it's not a library. Just include <stdbool.h>.
Code:#include <stdio.h>
#include <stdbool.h>
int main(int argc, char * * argv) {
bool b = getc(stdin) == 't' ? true : false;
if(b) printf("True\n");
else printf("False\n");
}
use 'int' for boolean type.
what kind of boolean functions are you talking about?
I am using Visual C and i get an error when I #include <stdbool.h>!! I think i found it. It seems to work with BOOL but not with bool
The actual type is _Bool, but it's macroed to bool. Visual C++, I'm assuming version 6, since that's what most people that use it around here have, is old, and doesn't support C99 fully.
Quzah.
Neither does Visual C++ 2003, nor 2005. Microsoft just doesn't support C99. They are entirely focused on C++, and it seems, they could care less about C. :mad: