Hi... just a quick one...

what would:

would this return statement return x squared or something different?Code:`int somefunc(int x){`

return x * x;

}

Printable View

- 08-31-2007bobthebullet990quick question of curiosity about return statements
Hi... just a quick one...

what would:

Code:`int somefunc(int x){`

return x * x;

}

- 08-31-2007matsp
Yes, it would return (x * x), which is the same as x squared. At least until it overflows the integer (which happens with numbers bigger than sqrt(INT_MAX), most machines that would be sqrt((2^31)-1) -> 46340). [^ here means to the power of, rather than XOR].

--

Mats