Below is code based on the tutorial at
Why does the MessageBox show the correct value of 30 when debugging
without breakpoints, but shows a value of zero when adding a breakpoint
within Method(), and stepping through?
I am using Visual Studio Express 2008, compiling to DotNet 2.0.
Thanks,
Tim Sprout
class MyClass
{
public unsafe void Method()
{
int x = 10;
int y = 20;
int *sum = swap(&x, &y);
MessageBox.Show (" Value at Memory Address = " + *sum);
}
public unsafe int* swap(int* x, int* y)
{
int sum;
sum = *x + *y;
return ∑
}
}
private void btnDisplayMessa ge2_Click(objec t sender, EventArgs e)
{
MyClass mc = new MyClass();
mc.Method();
}
Why does the MessageBox show the correct value of 30 when debugging
without breakpoints, but shows a value of zero when adding a breakpoint
within Method(), and stepping through?
I am using Visual Studio Express 2008, compiling to DotNet 2.0.
Thanks,
Tim Sprout
class MyClass
{
public unsafe void Method()
{
int x = 10;
int y = 20;
int *sum = swap(&x, &y);
MessageBox.Show (" Value at Memory Address = " + *sum);
}
public unsafe int* swap(int* x, int* y)
{
int sum;
sum = *x + *y;
return ∑
}
}
private void btnDisplayMessa ge2_Click(objec t sender, EventArgs e)
{
MyClass mc = new MyClass();
mc.Method();
}
Comment