Thread: Boolean data type

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Jun 2005
    Posts
    28
    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");
    }

  2. #2
    Registered User
    Join Date
    Jul 2005
    Posts
    56
    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

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how do you resolve this error?
    By -EquinoX- in forum C Programming
    Replies: 32
    Last Post: 11-05-2008, 04:35 PM
  2. Using VC Toolkit 2003
    By Noobwaker in forum Windows Programming
    Replies: 8
    Last Post: 03-13-2006, 07:33 AM
  3. return a random data type?
    By Niara in forum C++ Programming
    Replies: 3
    Last Post: 10-25-2005, 12:58 PM
  4. Learning OpenGL
    By HQSneaker in forum C++ Programming
    Replies: 7
    Last Post: 08-06-2004, 08:57 AM
  5. gcc problem
    By bjdea1 in forum Linux Programming
    Replies: 13
    Last Post: 04-29-2002, 06:51 PM