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}
}

-- 
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/9c60ff1f-6ddb-4136-bfab-642c102a47c7n%40googlegroups.com.

Reply via email to