II)
a re-entrant recursive function is a function that is written so that
it can call itself over and over to finish a problem, or can be called by
multiple other functions. Re-entrant recursive functions are tricky
in that you have to make sure you get to a recognizable point to say you
are through. One possible re-entrant recursive function can be one that
adds the numbers from one to the passed number:
int add_all_num(int num)
{
int x;
int y;
int z;
y = 0;
z = 0;
x = num ;
if (x-1)
y = add_all_num(x-1);
return(x+y);
}
you have to avoid stack crashes. re-entrant functions and recursive
functions can be stack hogs.
Rules of thumb for re-entrant functions:
1. don't use global variables
Rules of thumb for recursive functions:
1. see above
2. make sure the recursion will end.
On Thu, 4 Mar 1999, Chetan Sakhardande wrote:
>
> )
> What is an AVL tree?
>
> II)
> WHat is a reentrant function?
>
> III)
<snip>