Comment Re:Keep it simple! (Score 1) 956
(Ayee, my regrets: my former reply was added as HTML where it should have been plain-old text.)
I consider goto (like some before me) obsolete and its use obnoxious.
This function screams for a simple for-loop. I know it is possible to use fewer local variables and a little less arithmetic. Probably there is also a more elegant recursive solution, however tending to be less readable and more error-prone. Coding-quality should prevail above beauty and elegance?
SOLUTION EXAMPLE
int multiply( int a, int b)
{
int x=0;
int y=1;
if (!( a > 0 )) return -1;
for (y=1; y=a, y++)
{
x+=b
}
return x;
}