RECURSION AND STACK

In c recursion and stack are closely related concept when a function call itself recursively the system alocates memory on the stack to stare information about each invocation of the function .

The stack memory is used to keep track of functions local variable, parameter and return address.

#include<stdio.h>

int add(int, int);

int main()

{

  int a=5,b=2,c;

  c=int add(a, b);

  printf(“%d/n”, c);

}

  int add(int i, int j)

{

  int sum=i+j;

  return sum;

}