iOS中boolean、Boolean、BOOL、bool的區別

iOS中boolean、Boolean、BOOL、bool的區別測試

 

 

  1. bool t1 =1;//true or false  
  2. BOOL t2 = 3;//YES or NO  
  3. Boolean t3 =1; //unsigned char type  
  4. boolean_t t4 = 1;//int type  
  5. NSAssert(t1,@"bool t1 is NO");//經過測試  
  6. NSAssert(t2,@"BOOL t2 is NO");//經過測試  
  7. NSAssert(t3,@"Boolean t3 is NO");//經過測試  
  8. NSAssert(t4,@"boolean_t t4 is NO");//經過測試  

 

bool 是int型,bool b 當b!=0 有 b=true.net

BOOL 是unsigned char型,BOOL b 當b=1 有 b=YESblog

Boolean 是char型get

boolean_t 是int型class

注意:上述類型做爲判斷條件時只要變量值不爲零,則條件成立。變量

相關文章
相關標籤/搜索