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?
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?
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.