How to print Boolean flag in NSLog?

后端 未结 11 2349
深忆病人
深忆病人 2020-12-02 04:06

Is there a way to print value of Boolean flag in NSLog?

11条回答
  •  春和景丽
    2020-12-02 04:33

    Booleans are nothing but integers only, they are just type casted values like...

    typedef signed char     BOOL; 
    
    #define YES (BOOL)1
    #define NO (BOOL)0
    
    BOOL value = YES; 
    NSLog(@"Bool value: %d",value);
    

    If output is 1,YES otherwise NO

提交回复
热议问题