Is it possible for an int variable to be non-negtive and non-positive?
I have this:
void foo()
{
int i = /*something*/
int j = -i;
if ((i >= 0) || (j >= 0))
return;
std::cout << "Worked";
}
First of all, I've tried to assign an std::numeric_limits<int>::quiet_NaN,
but it returns a zero. Here I found that integer values can't be NaN (and
it means that ints always passes if(i!=i){...} test). So my question is:
is it possible to assign something to i variable in foo() to perform an
output?
No comments:
Post a Comment