class
Program
{
static void Main( string [] args)
{
unsafe
{
int i = 100 ;
int * j = & i;
* j = 101 ;
Console.WriteLine( " i = " + i);
Console.Read();
}
}
}
{
static void Main( string [] args)
{
unsafe
{
int i = 100 ;
int * j = & i;
* j = 101 ;
Console.WriteLine( " i = " + i);
Console.Read();
}
}
}
注:【运行代码前,请打开项目属性,在生成选项卡里,勾选“允许不安全代码”】