Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 C std99 中使用 bool 数据类型,其定义在<stdbool.h>. 现在我希望用户给我输入。我必须在 scanf 中使用什么格式说明符来输入来自用户的 1 个字节的布尔值,然后在我的程序中对其进行操作。
<stdbool.h>
空无一人。
使用临时对象,因为其大小_Bool取决于实现。
_Bool
#include <stdbool.h> #include <stdio.h> bool b; int temp; scanf("%d", &temp); b = temp;