Answers for "understanding go pointers"

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
2

go pointers

&	address of / create pointer
*	dereference pointer
Posted by: Guest on January-12-2021

Browse Popular Code Answers by Language