C Programming

C – Recursive Function in C Programming

Recursive can be regarded as the ability of function defining an object in terms of a simpler case of itself.

It is a process by which a function calls itself repeatedly until some specific condition has been satisfied.

  1. The problem must be written in recursive form.
  2. The problem statement must include a stopping condition.

A function may directly or indirectly call itself in the course of its execution. If the function call is within its own body then the recursion is direct.

If the function calls another function which in turn calls the first function, then such recursion is known as indirect.

If the problem is solved by using loops then that is called iteration. Sometimes the problem can be solved iteratively or recursively. 

C Code,

int factorial(int);
int main(void){
int n;
printf(“Enter Number:”);
printf(“The factorial %d is %d”,n,factorial(n));
int factorial(int n){

Related Articles

Back to top button

Adblock Detected

Please turn off your Adblocker to view your content.