C99引入了一个_Bool类型来存储一个布尔值,该值只能是1(真)或0(假)。
#include <stdio.h>
int main() {
_Bool b = 0; /* false value */
}
_Bool通常通过标准头文件stdbool.h定义的别名 – bool来访问。
此标头还将宏true和false定义为1和0的别名。
#include <stdbool.h>
#include <stdio.h>
int main() {
bool b = true; /* true value */
}
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/tech/pnotes/266423.html