Is there any format specifier of bool in C?

In the following example, I’m trying to scan the value of boolean type of variable. When I compile in GCC, I get following warning,

warning: format ‘%d’ expects argument of type ‘int *’, but argument 2 has type ‘_Bool *’ [-Wformat=]
  scanf("%d",&b);

code:

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

int main()
{
        bool b;

        scanf("%d",&b);
        printf("%d\n",b);
}

My question is, Is there any format specifier of bool in C

Leave a Comment