how to print boolean in c
printf("%s", x ? "true" : "false");
how to print boolean in c
printf("%s", x ? "true" : "false");
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
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us