what is Boolean value ?

Np Ms Office 365/Excel 2016 I Ntermed
1st Edition
ISBN:9781337508841
Author:Carey
Publisher:Carey
Chapter4: Analyzing And Charting Financial Data
Section4.2: Charts, Sparklines, And Data Bars
Problem 6QC
icon
Related questions
Question

what is Boolean value ?

Expert Solution
Step 1

The boolean data type has two values: either TRUE or FALSE.

Often we use the boolean value in a conditional checkpoint to check whether the condition satisfies or not. 

Let us consider a simple coding example as below :

#include<stdio.h>
#include<stdbool.h>
int main()
{
    bool x = false;                                                 // boolean type variable initialized
    if(x==true)                                                     // conditional statements
             {
                printf("The value of x is true");
             }
   else
            printf("The value of x is FALSE");
    return 0;
}

In the above-mentioned example, variable x is declared as a boolean data type and initialized with a value of false. Now, the conditional statement of if ( ) checks whether x has the value of true or not. As x has initialized with the value of false so it doesn't satisfy the if( ) condition and therefore else() block is executed and prints the statement " The value of x is FALSE " in the console.

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer