A
AMP
I have the following simple recursion and as I unwind the call stack
(stepping through it), I am trying figure out where the eventual
return value is being stored. Any help is appreciated.
Thanks
Mike
namespace Factorial
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
label1.Text = Factorial(5).ToString();
}
public int Factorial(int n)
{
if(n==0) return 1;
return n * Factorial(n-1);
}
}
}
(stepping through it), I am trying figure out where the eventual
return value is being stored. Any help is appreciated.
Thanks
Mike
namespace Factorial
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
label1.Text = Factorial(5).ToString();
}
public int Factorial(int n)
{
if(n==0) return 1;
return n * Factorial(n-1);
}
}
}