BOOLEAN IN C

Seema Roselin



Boolean In C

  • In C language, Boolean is a data type that represents true or false values. 
  • It is represented by a keyword "bool". 
  • False value is represented by the integer 0 and true value is represented by the integer 1.

Syntax:

bool variable_name;

Program:


  #include <stdio.h>
  #include <stdbool.h>
  int main(){
  bool red = false;
  if (red){
     printf("it is red in color.\n");
  } 
  else 
  {
    printf("it is not red in color.\n");
  }
  return 0;
  }


Output:


  It is not red in color.




More topic in C

Tags
Our website uses cookies to enhance your experience. Learn More
Accept !

GocourseAI

close
send