您的位置:首页 > 编程语言 > C#

c#指针用法示例。

2013-07-25 10:41 225 查看
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace ConsoleApplication1
{
struct CoOrds
{
public int x;
public int y;
}
class Program
{

static void Main(string[] args)
{
Console.WriteLine("************************************************************");

CoOrds home;
unsafe
{
CoOrds* p = &home;
p->x = 25;
p->y = 12;
System.Console.WriteLine("The coordinates are: x={0}, y={1}", p->x, p->y);

Console.ReadKey();
}
}
}
}


  编译时需要将项目属性中生成的允许不安全代码勾上。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: