Pointers
suggest changeA pointer to a type is the address of the value of that type in memory.
Zero value of a pointer is nil.
Unlike C, Go doesn’t have pointer arithmetic. You can take an address of a variable but you can’t add or substract from a pointer.
Pointer basics
var a int = 4
pa := &a
fmt.Printf("Address of a variable in memory is %p. Its value is: %d\n", pa, *pa)
Address of a variable in memory is 0xc00007e010. Its value is: 4
Learn more about pointers.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents