This article explains how a recursive function works.
A recursive function is one that calls itself. An example is the factorial function that calculates v! (for example 4!=1*2*3*4=24). It looks like this:
unsigned int factorial (unsigned int x)
if(x==0) return (1);
Each time the function calls itself puts instead of x the value x-1. When x==0 the program returns to main (). During these re-calls and returns function allocates memory space saving its local variables, the return value and the return address of the function. This is a dangerous process if x is large, due to small RAM memory space of a microcontroller.
Run the program.
We will use scanf function to send data to the microcontroller via ASC0 using the screen of Hyperterminal (At 19,200 kbaud).
For example type the number 4 and then 'Enter'. The result on the screen is 24. See it.