C Programming Language

Recursion

             Recursive functions are those functions, which call itself within that function. A recursive function must have the following type of statements.

  • A statement to test and determine whether the function is calling itself again.

  • A statement that calls the function itself and must be argument.

  • A conditional statement (if-else)

  • A return statement.

Example: Factorial of a number

             This is the most famous program on recursion. Many versions of this program are available. All programs differ only in checking conditions. I prefer to write like the following one.

Recursion
Pass by reference Home Static Storage classes

c program stats