简体   繁体   中英

when c++ return true / false if the data type is integer or double value

we are migrating project from c++ to c#. Can any one let me know when c++ return true or false for integer or double datatype value.

int a=3; or int a=-3; ... etc

if(a) //it will return true or false
{

}
else
{

}

对于0 ,返回false ,否则返回true

If the variable is non-zero then it's return true

int a = 3; //or any negetive number like a = -3

if(a){
//This part will execute
}
else
{

}

2nd part:

int a = 0;
if(a){

}
else
{
//this part will execute
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM