指针,引用,地址和动态内存分配
指针,引用,动态内存分配是C#,c,c++等语言中最强大的功能,它使程序员可以直接操纵内存来有效地管理内存(计算机中最关键和稀缺的资源),以获取最佳性能。
1.指针变量
计算机储存器的一个存储单元有着一个地址和它所保存的内容。这个地址是一个数字(通常用十六进制表示)
1.1指针变量
一个指针pointer是
int GetInt(){return 345;}
C# class is a reference type, if you declare like Student tom=new Student(); actually you declare a GCHandle, point to the Student obj. if you want to modify the GCHandle(meas you want to change the gchandle to another obj), you can pass the reference of the GCHandle ChangeStudnet(ref tom) the method declared as ChangeStudent(ref Student x) . IF you just want to modify the obj( edit the field of obj like tom.Name="Tommy" ,you just can pass the GCHandle,也就是直接传这个变量。
References
https://www3.ntu.edu.sg/home/ehchua/programming/cpp/cp4_PointerReference.html
