So I\'m just curious if there is a short hand statement to this:
if(number < 0 )
bigInt.sign = 0;
else
bigInt.sign = 1;
I see all th
Yes:
bigInt.sign = !(number < 0);
The ! operator always evaluates to true or false. When converted to int, these become 1 and 0 respectively.
Of course this is equivalent to:
bigInt.sign = (number >= 0);
Here the parentheses are redundant but I add them for clarity. All of the comparison and relational operator evaluate to true or false.