Saat suatu pointer di inisiasi tapi tidak di deklarasikan value-nya, maka value-nya adalah nil.
Contoh code
packagemainimport"fmt"funcmain() {// declare a pointer variablevar num *intvar str *stringvar dec *float64var isTrue *booltypeexamplestruct { num *int str *string } e :=example{} fmt.Println("Value of pointer:", num) fmt.Println("Value of pointer:", str) fmt.Println("Value of pointer:", dec) fmt.Println("Value of pointer:", isTrue) fmt.Println("Value of pointer:", e)}
Value of pointer: <nil>
Value of pointer: <nil>
Value of pointer: <nil>
Value of pointer: <nil>
Value of pointer: {<nil> <nil>}