Boolean in C

Seema Roselin

Boolean:

  • 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 colour.\n");
else 
{
 printf("it is not red in colour.\n");
}
return 0;
}

Output:

It is not red in colour.







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

GocourseAI

close
send