Semester : S1 and S2
Subject : Computer Programming
Year : 2017
Term : DECEMBER
Branch : BIOTECHNOLOGY
Scheme : 2015 Full Time
Course Code : CS 100
Page:31
b)Explain the concept of Recursive function with the help of an example C program to find Factorial of a
number.
Recursive functions.
Recursion is a special property of the function. When a function calls itself then it is called
recursion. In the function with name recfun the function definition contains the function call to itself.
The execution is as follows :
printf(“a= %d and b= %d”, a,b);
In the second function, the nu mbers are swaped because the function is called by reference and the values are
exchanged. The Address of variables are passed to the function. So whatever change we do in the function is done
in the value inside the address. The fig.depicts the same.
a (1000)
> 10
5 (1002) _ +. 5
~| (2000) 4000