dongqiao0953 2015-07-08 22:57
浏览 73
已采纳

此语法是指向切片的指针还是切片的指针?

After looking at this blog post, I am still unclear about whether the following syntax means a slice of pointers or a pointer to a slice.

foo  []*int

Which one is it, and what is the general rule of thumb for this case?

  • 写回答

2条回答 默认 最新

  • douzhu6149 2015-07-08 23:01
    关注

    This is a slice of pointers, just read from left to right: ([]) a slice of (*) pointers to (int) integer. On the other hand, *[]int would be (*) a pointer to ([]) a slice of (int) integers.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?