mirror of
https://github.com/chubin/cheat.sheets
synced 2024-11-19 03:25:44 +00:00
8 lines
267 B
Plaintext
8 lines
267 B
Plaintext
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
|
|
// new creates a pointer to a new struct instance
|
|
var s *Vertex = new(Vertex)
|