True and false values in C are integers - C Data Type

C examples for Data Type:bool

Description

True and false values in C are integers

Demo Code

#include <stdio.h>

int main(void)
{
    int true_val, false_val;
    /*from ww  w .ja v a 2  s.c  o  m*/
    true_val = (10 > 2);    // value of a true relationship
    false_val = (10 == 2);  // value of a false relationship 
    printf("true = %d; false = %d \n", true_val, false_val);
    
    return 0;
}

Result


Related Tutorials