04.12.2014, 10:49
So I have this(which is a code written from e pseudocode from our last class) C little recursive function.
Now to check it in main()
It never calls power3 again, checked it using printf's before and after, it repeats endlessly the before printf.
And it crashes my console and stops working.
Ani ideas? Also, I would like to ask you guys for a coding forum, so I can stop bothering you guys
pawn Code:
int power3(int x, int n);
int power3(int x, int n)
{
int p;
if(n == 2)
return (x * x);
else
p = power3(x, (n/2));
return (p * p);
}
pawn Code:
printf("%d", power3(2, 24));
pawn Code:
else
{
printf("B. %d", p);
p = power3(x, (n/2));
printf("A. %d", p);
}
Ani ideas? Also, I would like to ask you guys for a coding forum, so I can stop bothering you guys