Answers for "how does pointers work in go"

Go
3

go pointers

p := Vertex{1, 2}  // p is a Vertex
q := &p            // q is a pointer to a Vertex
r := &Vertex{1, 2} // r is also a pointer to a Vertex

// The type of a pointer to a Vertex is *Vertex

var s *Vertex = new(Vertex) // new creates a pointer to a new struct instance
Posted by: Guest on January-12-2021
0

Pointers in golang

func main () {
  b := *getPointer()
  fmt.Println("Value is", b)
}
Posted by: Guest on December-29-2021

Browse Popular Code Answers by Language