stdbool.h添加到源文件时,可以使用bool作为类型名称。stdbool.h将符号truefalse定义为分别对应于10。当转换为bool类型时,非零数值将导致1(true)0将转换为0(false)
如果在源文件中包含标头,则可以按如下方式编写声明:

#include <stdio.h> 
#include <stdbool.h> 
int main(void) { 

  bool valid = true;         // Boolean variable initialized to true
  printf("%d",valid);
  return 0; 
}