bool、true 与 false 成为关键字

版本新特性 / C23

// *** before: ***
//C99 to C17: the type was called _Bool, and bool, true and false
//were macros from <stdbool.h>; true was just the int 1
#include <stdbool.h>

_Bool doneOld = 0;
bool readyOld = true;
//readyOld is true

printf("readyOld is %s\n", readyOld ? "true" : "false");

// *** in version C23: ***
//bool, true and false are keywords: no header is needed,
//and true and false have the type bool instead of int
bool ready = true;
bool done = false;
//ready is true
//done is false

//typedef int bool;    <- error now: bool is a keyword
printf("ready is %s\n", ready ? "true" : "false");
printf("done is %s\n", done ? "true" : "false");