Golang Pointers

From UVOO Tech Wiki
Revision as of 04:27, 10 January 2021 by Busk (talk | contribs) (Created page with "``` Because Golang string is a read-only slices of bytes. However, a pointer to a string (*string) can be nil: var s *string s = nil readonly := "readonly" s = &readonly der...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Because Golang string is a read-only slices of bytes.

However, a pointer to a string (*string) can be nil:

var s *string
s = nil
readonly := "readonly"
s = &readonly
dereference := *s