control may reach end of non void function
I am getting the error control may reach end of non void function, but i cannot figure out why. This is what i have
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
bool operator == (const MyNum& x, const MyNum& y)
{
int xLen = x.current,
yLen = y.current,
i, a, b, count = 0;
if (xLen == yLen)
{
for (i = 0; i < xLen; i++)
{
a = Convert(x.num[i]);
b = Convert(y.num[i]);
if (a == b)
{
count++;
}
else if (a != b)
{
return false;
}
}
if (count == xLen)
{
return true;
}
else if (count != xLen)
{
return false;
}
}
else if (xLen != yLen)
return false;
}
|
Remove line 34. Why you need another if?
Is this for a quantum computer? (who wrote this quote, can I kiss him?)
Same at line 29.
i still get that error after removing both else ifs.
I dont understand why it would reach the end of the function when no matter what it's returning a true or a false?
Topic archived. No new replies allowed.