What is the printf format specifier for bool?

前端 未结 8 768
有刺的猬
有刺的猬 2020-11-28 17:13

Since ANSI C99 there is _Bool or bool via stdbool.h. But is there also a printf format specifier for bool?

I mean

8条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-28 18:00

    You can't, but you can print 0 or 1

    _Bool b = 1;
    printf("%d\n", b);
    

    source

提交回复
热议问题