Function: Recursive call : Function Recursive « Function « C / ANSI-C






Function: Recursive call

  
#include <stdio.h>

void f(int i);

int main(void)
{
  f( 0 );

  return 0;
}

void f(int i)
{
  if( i < 10) {
    f( i + 1 ); /* recursive call */
    printf("%d ", i);
  }
}


           
       








Related examples in the same category

1.A recursive power functionA recursive power function
2.Calculating factorials using recursion
3.Prints out Fibonacci numbersPrints out Fibonacci numbers
4.Recursive function call
5.Copy string using recursion
6.Recursive function with static variable