Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,950 questions

51,892 answers

573 users

How to use boolean (bool) datatype in C

2 Answers

0 votes
#include <stdio.h>
#include <stdbool.h>

int main(void)
{

    bool b = false;
    
    printf("%d\n", b);
    
    if ( 31 > 14) b = true;
    
    printf("%d\n", b);

        
    return 0;
}

/*
run:
 
0
1

*/

 



answered Aug 30, 2016 by avibootz
0 votes
#include <stdio.h>
#include <stdbool.h>

int main(void) 
{
    bool a = true;  
    bool b = false; 
    
    if (a)  
    {
        puts("a = true");
    }
    if (!b) 
    {
        puts("b = false");
    }
    
    return 0;
}
    
/*
run:
 
a = true
b = false

*/

 



answered Aug 22, 2017 by avibootz

Related questions

1 answer 162 views
162 views asked Feb 26, 2016 by avibootz
3 answers 214 views
214 views asked Jan 2, 2017 by avibootz
1 answer 127 views
127 views asked Aug 28, 2023 by avibootz
1 answer 150 views
150 views asked Mar 9, 2019 by avibootz
1 answer 165 views
165 views asked May 14, 2018 by avibootz
2 answers 274 views
...