How to print boolean in c Code Answer's
The Boolean data type is used to store a logical condition, where TRUE or FALSE represents the result of an expression or statement. You can use Boolean variables as flags to indicate whether a condition is true or not. When you have a boolean variable, it can be easily printed in the console by using the %b format specifier.
how to print boolean in c
By Adventurous Addax
on Dec 14, 2020
printf("%s", x ? "true" : "false");
Source: stackoverflow.com
2
print bool c
on Jan 01, 1970
// there is no way of pretty-print a boolean with printf
printf("%i", true); // will print 1
printf("%i", false); // will print 0
// but we can create a macro
#define formatBool(b) ((b) ? "true" : "false")
printf("%s", formatBool(true)); // will print true
printf("%s", formatBool(false)); // will print false
0
The Above Code example shows how to print boolean in C programming language.
C answers related to "how to print boolean in c"
how to print boolean in c C print 2D array how to print boolean in c print char in c print char in c printf binary
View All C queries
C queries related to "how to print boolean in c"
Browse Other Code Languages
Abap ActionScript Assembly BASIC C C# C++ Clojure Cobol CSS Dart Delphi Elixir Erlang F# Fortran Go Groovy Haskell Html Java Javascript Julia Kotlin Lisp Lua Matlab Objective-C Pascal Perl PHP PostScript Prolog Python R Ruby Rust Scala Scheme Shell/Bash Smalltalk SQL Swift TypeScript VBA WebAssembly Whatever