Search
 
SCRIPT & CODE EXAMPLE
 

C

how to print boolean in c

printf("%s", x ? "true" : "false");
Comment

print bool c

// 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
Comment

PREVIOUS NEXT
Code Example
C :: check if the c code is a palindrome 
C :: printf type format 
C :: matplotlib plot circle marker 
C :: how to create calculator with switch in c 
C :: c fork wait for child 
C :: get range of values in mongodb 
C :: malloc in c 
C :: check if string in string c 
C :: how to make a linked list in c 
C :: how to modulo in c without use the operator 
C :: initialize array in c with 0 
C :: callback c++ c 
C :: add a item to cart woocomerce with quantity 
C :: C Programming to swap two variables 
C :: isspace 
C :: Fibonacci Series Program. in c 
C :: identifier bool is undefined in c 
C :: selection sort algorithm in c 
C :: c check if character is a space 
C :: c remove last charachter from string 
C :: sh: tailwindcss: command not found 
C :: debian unhold packages 
C :: binary tree count number of leaves in c 
C :: c extern 
C :: 1000000000 
C :: Multi-line Comments in C 
C :: sphinx-doc 
C :: arduino dont working dc motor 
C :: solutionadda 
C :: While loop output 
ADD CONTENT
Topic
Content
Source link
Name
5+5 =