“Cómo imprimir booleano en c” Código de respuesta

Cómo imprimir booleano en c

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

Imprimir 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
Thoughtful Trout

Respuestas similares a “Cómo imprimir booleano en c”

Preguntas similares a “Cómo imprimir booleano en c”

Más respuestas relacionadas con “Cómo imprimir booleano en c” en C

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código