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

前端 未结 2 1025
情话喂你
情话喂你 2021-01-26 04:10

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; ...         


        
相关标签:
2条回答
  • 2021-01-26 04:50

    It returns false for 0 and true otherwise.

    0 讨论(0)
  • 2021-01-26 04:51

    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
    }
    
    0 讨论(0)
提交回复
热议问题