关于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的&和*的区别以及应用场景的详细内容,更多文章请关注木庄网络博客!!

返回前面的内容

相关阅读 >>

Go设计模式之工厂模式浅谈

一文读懂云原生 Go-zero 微服务框架

Golang和python的区别

聊聊nacos-coredns-plugin的servermanager

Go - 环境安装

关于Golang Gopath的新用法

ubuntu配置Golang

Go语言基础之基本数据类型

test

Golang中将字节流转为protobuf

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




打赏

取消

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

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

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

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

评论

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