How to use Conditional Statements In C Language

C




// C program to demonstrate Boolean to String
// Conversion using conditional statements
#include <stdbool.h>
#include <stdio.h>
int main()
{
 
    bool n = true;
    if (n == true) {
        printf("true");
    }
    else {
        printf("false");
    }
    return 0;
}


Output

true

C Program For Boolean to String Conversion

To convert boolean to string in C we will use the following 2 approaches:

  1. Using Conditional Statements
  2. Using Ternary Operator

Input: 

bool n = true 

Output: 

string true

Similar Reads

1. Using Conditional Statements

C // C program to demonstrate Boolean to String // Conversion using conditional statements #include #include int main() {       bool n = true;     if (n == true) {         printf("true");     }     else {         printf("false");     }     return 0; }...

2. Using the ternary operator

...