c 语言 整数布尔值
C originally did not have native support for boolean values.
C最初不支持布尔值。
C99, the version of C released in 1999⁄2000, introduced a boolean type.
C99是1999年 / 2000年发布的C版本,引入了布尔类型。
To use it, however, you need to import a header file, so I’m not sure we can technically call it “native”. Anyway, we do have a bool
type.
但是,要使用它,您需要导入头文件,因此我不确定我们在技术上可以称其为“本机”。 无论如何,我们确实有bool
类型。
You can use it like this:
您可以像这样使用它:
#include <stdio.h>
#include <stdbool.h>
int main(void) {
bool isDone = true;
if (isDone) {
printf("done\n");
}
isDone