Using boolean values in C

前端 未结 18 1814
被撕碎了的回忆
被撕碎了的回忆 2020-11-22 12:51

C doesn\'t have any built-in boolean types. What\'s the best way to use them in C?

18条回答
  •  粉色の甜心
    2020-11-22 13:19

    This is what I use:

    enum {false, true};
    typedef _Bool bool;
    

    _Bool is a built in type in C. It's intended for boolean values.

提交回复
热议问题