Although I have read a few articles, I have summarized them.
First, call yourself
Second, the order is large to small.
Third: When the variable is 1, the recursive if (temp = 1) return 1 is introduced; that is, the exit must be set; otherwise, the loop will continue.
Fourth:
When a function calls itself, it allocates memory for the new local variables and parameters in the stack, and the function code re-runs with these variables and parameters. Recursive calls do not copy the function code again, but the parameters are new. When each recursive call returns, the old local variables and parameters are removed from the stack, and the function call point within the function is restarted. Recursive functions are described as "push and pull" for themselves ".
Fifth: recursive operation is slow and memory consumption
Sixth: dynamic planning can be effective without repeated operations
End
In imperative programming, we can often use loops instead of recursion to solve some problems, so as not to cause stack overflow due to data size. However, in functional programming, the only method to implement a "loop" is "recursion". Therefore, tail recursion and CPS are of great significance for functional programming. Understanding tail recursion is also very helpful for programming thinking. Therefore, you may wish to think more and practice it for your own use.
Reference: http://www.cnblogs.com/winter-cn/archive/2008/08/23/1274475.html
Http://msdn.microsoft.com/zh-cn/library/z3dk2cc3
Http://www.cnblogs.com/jeffreyzhao/archive/2009/04/01/tail-recursion-explanation.html
I understand it in theory, but it won't be used ~ Please advise