指针
随写
Go语言中的函数传参都是值拷贝
类型指针不能进行偏移和运算
当一个指针被定义后没有分配到任何变量时,它的值为 nil
引用类型的变量使用时不仅需要声明还需要分配内存空间
new与make
- 用于分配内存
- make只用于slice、map以及channel的初始化,返回的还是这三个引用类型本身
- new用于类型的内存分配,并且内存对应的值为类型零值,返回的是指向类型的指针
If you like this blog or find it useful for you, you are welcome to comment on it. You are also welcome to share this blog, so that more people can participate in it. If the images used in the blog infringe your copyright, please contact the author to delete them. Thank you !