搞不懂C语言 指针的意义!

以下是C#中的指针用法,C语言的指针除了可以随意读取内存之外,不知道有啥好处,我把指针比喻成数组下表。

而内存就如一条超级大的数组。

我真的越来越 搞不懂指针的意义,处了可以越界有啥好处了。
MyStruct Struct=new MyStruct();
MyStruct  refMyStruct = ref Struct;
这样完全可以取代指针了.
那么 refMyStruct 间接操作 Struct 。
如果无需Struct 了。
就指向 其他 MyStruct 的 对象。
就如给 对象 起 了一个 别名一样。

但有必要那么多别名吗。

我反而觉得类名就应该增加 别名的需求。

如   Car<IntelliCreature Human<HugeMan>>,Electric<Battery<Nuclear>>>  newestCar= new  Car<IntelliCreature Human<HugeMan>>,Electric<Battery<Nuclear>>> ();

这么长的类名确实让人不爽。经常问着到底是什么呢。 我认为这样的类型才应该来个别名 。

#Declare TypeName: NewestCarType = Car<IntelliCreature Human<HugeMan>>,Electric<Battery<Nuclear>>> ;

NewestCarType newestCar=new NewestCarType ();

#unDeclare

如果是我 就会发明上述语法的了。

发布了53 篇原创文章 · 获赞 12 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/q158805972/article/details/99131742