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

返回前面的内容

相关阅读 >>

又掉进slice切片的坑里面了

Golang适合web开发吗?

Go语言函数闭包

Golang文件复制

Golang如何连接ldap

leetcode Golang

Golang能封装成dll吗

聊聊dubbo-Go-proxy的client

Golang的内存管理(中篇)

怎么运行Go语言程序

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




打赏

取消

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

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

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

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

评论

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