Using true and false in C

后端 未结 15 1896
情书的邮戳
情书的邮戳 2020-12-01 01:52

As far as I can see there are 3 ways to use booleans in c

  1. with the bool type, from then using true and false
  2. defining using preprocessor #defin
15条回答
  •  臣服心动
    2020-12-01 02:38

    You can test if bool is defined in c99 stdbool.h with

    #ifndef __bool_true_false_are_defined || __bool_true_false_are_defined == 0
    //typedef or define here
    #endif
    

提交回复
热议问题