In C programming language when a function calls itself over and over again , that function is called recursive function .The process of function calling itself repeatedly is known as recursion .
Recursion is supported by C programming language i.e., a function to call itself repeatedly again and again and while using this function the programmer needs to be careful that there should be an exit function in the program,else it will go in infinite loop.
In the C recursive function it allow us to break a complex problem into identical sub-problems recursively until each and every sub problem are simple enough so that they can be solved directly in C language.Then at last the solutions of the identical sub problems are combined to make the final solution.
Advantage of Recursion
In recursion we use the divide and conquer approach to divide the original problem to sub problem and hence replaces complex nesting code.
Disadvantage of Recursion
C Recursion uses lot of stack space, usually it is not used when the program is small and running on a PC. It is hard to debug the code or extend the functionality in case of recursive logic.
Below is the code example of Factorial using recursion
int facto (int);
printf(\nEnter a positive number:);
int facto(int m)