On Tue, Mar 5, 2024, 8:33 PM Matheus Fassis Corocher < matheuscoroc...@gmail.com> wrote:
> I was studying about pointers and struct in Golang and one thing that I > don't understand is why using * in return of signature of function instead > of & if the return of function is an address of variable? > > The correct version that works: > > func NewVertex(X, Y int) **Vertex* { > ... > return &Vertex{X, Y} > } > > The version in my mind should be correct: > > func NewVertex(X, Y int) *&Vertex* { > ... > return &Vertex{X, Y} > } > It was considered, but following the C programming language was the final choice. Ian > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAOyqgcVeBEWYteh5p7-LCguL4e25vvycsBsta%2BLcm6tve1WWCg%40mail.gmail.com.