Recursion in c

Recursion in c, in which a function call itself, until a given condition is not met. Such functions are called recursive function. If condition is not specified then function calls itself infinite times and may crash.

Syntax

<return_type> <function_name>(parameter list);

<return_type> <function_name>(parameter list)
{
   // set of statements
   // Exit condition for recursive function
   // function call
}

Example

#include<stdio.h>

int add(int);

void main()
{
  int c = 0;
  c = add(5);
  printf("%d ", c);
}

int add(int no)
{
    if(no == 0)
    {
      return 0;
    }
     int c = no + add(no - 1);
    
    return c;
}