Concept
What happens when a function calls itself?
ComputerScienceOne / Recursion
"The function in this case is called CountDown (). In Line 5 the function calls itself on a decremented value. When a function calls itself, it is a recursive function. When a language allows functions to call themselves they support recursion . This is not that odd of a concept. We’ve seen many examples where functions invoke (call) other functions. Each function call simply creates a new stack frame on the program stack. There is nothing particularly special about which functions call which other functions, so there is little difference when a function calls itself."
Related Ideas
- How can recursive functions be written in C?ComputerScienceOne · Recursion
- How is recursion implemented in Java?ComputerScienceOne · Recursion
- How can a recursive method sum the elements of an array?ComputerScienceOne · Recursion
- How can recursion be made tail-recursive in C?ComputerScienceOne · Recursion
- How can you implement ordinary and tail-recursive summation functions in PHP?ComputerScienceOne · Recursion
- How is memoization implemented for recursive Fibonacci in C?ComputerScienceOne · Recursion
- How can Fibonacci numbers be computed recursively in Java?ComputerScienceOne · Recursion
- How can BigInteger be used for large recursive Fibonacci values?ComputerScienceOne · Recursion