2
0
mirror of https://github.com/chubin/cheat.sheets synced 2024-11-05 12:00:16 +00:00
cheat.sheets/sheets/_go/Pointers
terminalforlife d7473ac185 Fix trailing whitespace on all files
Tidy files; tidy soul!
2020-02-22 02:47:54 +00:00

8 lines
266 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)