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 :: C float division 
C :: string to int c 
C :: how to find all the missing dates and increment the series in r 
C :: vowel or consonant in c 
C :: c boolean 
C :: lerp function c 
C :: binary search in c 
C :: first program in c 
C :: fonction recursive successeur nombre chaine de caractere en c 
C :: print ascii value in c 
C :: get current used proxy windows 7 
C :: merge sort code c 
C :: arduino millis() 
C :: how to turn off zsh 
C :: ROUNDING decimal number in C 
C :: c program strtok use 
C :: Array Input/Output in C 
C :: add char to char array c 
C :: toupper function in c 
C :: double array in c 
C :: enum in c 
C :: c functions example 
C :: typedef vs #define 
C :: adjacency matrix representation maker 
C :: how to input n space separated integers in c 
C :: maximo comun divisor 
C :: open with overwrite c 
C :: -42 c to f 
C :: snprintf c 
C :: C float and double Output 
ADD CONTENT
Topic
Content
Source link
Name
9+2 =