I think there has to be a way to keep the original value of n, so I have a reference, each time function runs, & I can calculate with third variable the value I need.
this code does not work good but, demonstrate this idea.
please comment.

http://c2.com/cgi/wiki?TailCallOptimization
Recursion is just a disguised loop.
Simple recursive functions, especially those where the recursive step is the last thing to be done, can often be reduced by the compiler to a loop.

> this code does not work good but, demonstrate this idea.
You should be doing
return half(x);

hmm... what exactly are you trying to do?
I dont understand "Need to write a function which returns the values of n/2, when gets the valuue of n."

Originally Posted by Bjarne Stroustrup (2000-10-14)

I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.

I need to return the value of n, devided by 2; As an integer, not a float.
is that better phrased?

In that case, why in the world do you need recursion?

Wouldnt a simple return n/2; work?

Originally Posted by Bjarne Stroustrup (2000-10-14)

I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.

If you want to practise recursion...I'd use something more applicable. My C++ book used the following idea to illustrate it:

Fibonacci Sequence goes like 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, etc
each number is equal to the number before it plus the number before that (1+2=3, 2+3=5, 3+5=8, etc)
Take in a number, and output its fibonacci value
input:
5
output:
x is the 5th fibonacci number