Monday 15 June 2009

Function recursion in C programming


Calling of same function
from its function body is known as function recursion. It is alternative of
loop. Any c program which is possible using loop it must be possible using
function recursion. Simple example:



Find the sum of all even
numbers from 0 to 20 using function recursion. Program:



int main(){

int total;

total=sum(2);

printf("%d",total);

return 0;

}

int sum(int i){

static 

No comments:

Post a Comment