howdy,
This is my first recursion program...
Need to write a function which returns the values of n/2, when gets the valuue of n. this is what I wrote:
Somehow recursion doesn't ever happen. Debugger shows the function enters the 'else', but doesn't commit the half(x);Code:int half (int n)
{
int x,y;
if (n==0)
return 0;
x = n-2;
y = n-x;
if (y >= x)
return (y);
else
{
half(x);
}
return (y);
}
Why??