Format specifier in scanf for bool datatype in C

c, format-specifiers, scanf

Solution

There is none.

Use a temp object as the size of `_Bool` is implementation dependent.

#include <stdbool.h>
#include <stdio.h>

bool b;
int temp;

scanf("%d", &temp);
b = temp;

Problem

I am using bool datatype in C std99 whose definitions are defined in `<stdbool.h>`. Now I want the user to give me input. What format specifier I must use in scanf to input the boolean value of 1 byte from the user and then manipulate it afterwards in my program.

Original source

Related problems