Recursion
Nesting of functions
is when a function calls another function and that
second function calls the third one . But a
recursive function is the function that calls
itself repeatedly.
Recursion is simply a
function that calls itself, its advantage is that
the code we write gets short and it gets easy to
solve problems.
Example1:

Example2:
void rec()
{
rec(); //Function calls itself
}
int main()
{
rec(); //Setting off recursion
}
How to Calculate Factorial Using Recursion

Recursion vs Iteration
Recursion is repeatedly
calling the function, whereas Iteration is nothing
but just looping until condition doesn't satisfy.
Recursive is lot slower
than iterative. Recursive function uses more memory.
Recursion is when a part
of code calls itself (directly or indirectly)
whereas iteration works in cycle as mentioned
before.
A recursive function
works through the process of calling itself until a
condition is met. Iteration uses a looping control
structure (while, do while, for) to repeat a section
of code until a condition is met
COPYRIGHT 2009 ALL RIGHTS RESERVED
FREECPROGRAMS.COM