Golang Pointers

Get pointer from variable:

pointer = &i

Get value from pointer:

*pointer

Change value by pointer:

*pointer = 123

Specify parameter type as pointer:

func (daughter *Person) {}
package main

import (
	"fmt"
)

func changeThroughFunction(value *int) {
	*value = 5
}

func main() {
	i := 1
	iPointer := &i
	fmt.Println(i)

	// change directly
	i = 2
	fmt.Println(i)

	// change by pointer
	*iPointer = 3
	fmt.Println(i)

	// change through insanity
	*(&(*(&(*(iPointer))))) = 4
	fmt.Println(i)

	changeThroughFunction(iPointer)
	fmt.Println(i)
}