Recursive error

• This code of mine is showing infinite loop:-

#include"declarations.h"
double power(double x, double y)
{
double result;
#ifdef DEBUG
printf("%s: Begin.\n",__func__);
#endif
printf("enter the base value.\n");
scanf("%lf",&x);
printf("enter the power .\n");
scanf("%lf",&y);
result= power(x,y);
#ifdef DEBUG
printf("%s: End.\n",__func__);
#endif
}
main:-
#include"declarations.h"
int main(){
#ifdef DEBUG
printf("%s:Begin.\n",__func__);
#endif
double a,b;
scanf("%lf%lf",&a,&b);
power(a,b);
#ifdef DEBUG
printf("%s:End.\n",__func__);
#endif
}

• give a control to exit from recursion, any increment or decrement variable or any checking condition
• suppose that take input as base=2 and power=3.We enter function power(),double power(double a,double b)

a=2 and b=3

if(b==0) false

else

return (a*power(a,b-1)); i.e. return (2*power(2,3-1)); i.e. return (2*power(2,2));

A recursive call[power(2,2)]

if(e==0) false

else

return (a*power(a,b-1)); i.e. return (2*power(2,2-1)); i.e. return (2*power(2,1));

A recursive call[power(2,1)]

if(e==0) false

else

return (a*power(a,b-1)); i.e. return (2*power(2,1-1)); i.e. return (2*power(2,0));

A recursive call[power(2,0)]

if(e==0) true

return 1

So now we will have

1    … power(2,0)

2*1 = 2    … power(2,1)

2*2 = 4    … power(2,2)

2*4 = 8   …power(2,3) ….final answer