How to use boolean datatype in C?

后端 未结 7 596
没有蜡笔的小新
没有蜡笔的小新 2020-12-23 13:59

I was just writing code in C and it turns out it doesn\'t have a boolean/bool datatype. Is there any C library which I can include to give me the ability to return a boolean

相关标签:
7条回答
  • 2020-12-23 14:38

    C99 has a boolean datatype, actually, but if you must use older versions, just define a type:

    typedef enum {false=0, true=1} bool;
    
    0 讨论(0)
提交回复
热议问题