recursive subroutine การใช้
- Here is an example of recursive subroutine in C / C + + to find Fibonacci numbers:
- Each " syntax equation " is translated into a recursive subroutine which tests the input string for a particular phrase structure, and deletes it if found.
- However, another advantage of the call stack method is that it allows recursive subroutine calls, since each nested call to the same procedure gets a separate instance of its private data.
- The JIL instruction performs a Jump Indirect, like the JI instruction, but saves the value in the program counter, S, into the link register, L . This allows very simple non-recursive subroutine calls to be achieved.
- There is no concept of locally recursion difficult, but some cases of recursion where no subroutine state values are needed after the recursive call are possible if variables dedicated to the recursive subroutine are explicitly cleared ( or re-initialized to their original value ) on entry to the subroutine.
- (In principle, one could continue dividing the matrices until a base case of size 1 & times; 1 is reached, but in practice one uses a larger base case ( e . g . 16 & times; 16 ) in order to amortize the overhead of the recursive subroutine calls .)