BOOL類型、int型、float型及指針變量與“零值”比較

原文鏈接:https://blog.csdn.net/ZYZMZM_/article/details/102717590
  1. bool值
bool flag;
if(flag)
if(!flag)

2.int,short

int a;
if(0 == a)
if(0 != a)

3.float

float x;
const float EPSINON = 0.00001;
if((x >= -EPSINON) &&(x <= EPSINON))

4.char*

char* p;
if(nullptr == p)
if(nullptr != p)
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章