In C, there is no bool
type, so you have to define and write it yourself.
I'll introduce three things that are commonly used
typedef int bool;
#define true 1
#define false 0
typedef int bool;
enum { false, true };
typedef enum { false, true } bool;
#include <stdbool.h>
Choose any of these
Personally, I don't like 4 because it can only be used in C99
I think 2 and 3 are better because they don't use #define
.
© 2024 OneMinuteCode. All rights reserved.