Create and use recursion - C Function

C examples for Function:Recursive Function

Description

Create and use recursion

Demo Code

#include <stdio.h>

void myfunction(int);

int main(void)
{
    myfunction(1);//w w  w  .j av a  2  s.  c  om
    return 0;
}

void myfunction(int n)
{
    printf("Level %d: n location %p\n", n, &n); // 1
    if (n < 4)
        myfunction(n+1);
    printf("LEVEL %d: n location %p\n", n, &n); // 2
    
}

Related Tutorials