T
Tim Sprout
Below is code based on the tutorial at
http://tinyurl.com/3f3zy9
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 btnDisplayMessage2_Click(object sender, EventArgs e)
{
MyClass mc = new MyClass();
mc.Method();
}
http://tinyurl.com/3f3zy9
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 btnDisplayMessage2_Click(object sender, EventArgs e)
{
MyClass mc = new MyClass();
mc.Method();
}