关于go的&和*的区别以及应用场景


当前第2页 返回上一页

这个就不太理解了

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

package mainimport "fmt"type Test struct {

    name string}func main() {

    test := Test{"test"}

    fmt.Println(test)

    //结果{test}

 

    testa := &Test{"test"}

    fmt.Println(testa)

    //结果 &{test}

 

    testc := &Test{"test"}

    fmt.Println(*testc)

    //结果 {test}

 

 

    testd := &Test{"test"}

    fmt.Println(&testd)

    //结果 0xc000006030}

以上就是关于go的&和*的区别以及应用场景的详细内容,更多文章请关注木庄网络博客!!

返回前面的内容

相关阅读 >>

Golang 获取当前外网ip/地址/运营商

详解Golang中函数作为值与类型

Go get下载包失败问题

详解Golang怎么开发windows窗口界面

手撸Golang 基本数据结构与算法 图的最短路径  狄克斯特拉算法

Go语言开发工具

Golang怎么判断map是否为空

Go的声明语法为什么是这样

手撸Golang 行为型设计模式 策略模式

now扩展-Go的时间工具箱

更多相关阅读请进入《Go》频道 >>




打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...