c# -> 箭头 操作符(运算符) And指针
发布日期:2021-05-07 10:31:46 浏览次数:25 分类:精选文章

本文共 539 字,大约阅读时间需要 1 分钟。

namespace ConsoleApp1{       class Program    {           static void Main(string[] args)        {               unsafe            {                   Student stu;                stu.ID = 1;                stu.Score = 99;                Student* pStu = &stu;                pStu->Score = 100;                // 100                Console.WriteLine(stu.Score);            }        }    }    ///     /// 指针操作,取地址操作,用指针访问成员的操作,    /// 只能用操作结构体类型,不能操作引用类型    ///     struct Student    {           public int ID;        public long Score;    }}
上一篇:c# ~ 运算符 待研究
下一篇:c# sizeof() 计算结构体所占的字节 And 自定义结构体

发表评论

最新留言

很好
[***.229.124.182]2025年04月06日 11时16分30秒