Intro to recursive functions
 

Recursion:

  • A recursive method/function F( ) is a method/function that contains a call (= invocation) to the (same) method/function F( )

Important note:

  • A recursive method/function is always a non-leaf method/function !!!

    (Because it always contains a function call !!!)

Consequence for assembler programming of recursive functions
 

How must we pass parameters and allocate local variables for recursive functions:

  • A recursive method/function F( ) must use the runtime stack to store its parameters and local variables !!!

    (You cannot store parameters and local variables in registers because will surely by overwritten !!!)

Is there anything special about recursive function ?
 

Is there anything else special about recursive function ?

  • No

    Just apply the stack technique for storing parameters and local variables when you code a recursive function and it will work !

 

You have learned everything you need to code a recursive function (or any function !!!)