Difference between revisions of "Golang Pointers"

From UVOO Tech Wiki
Jump to navigation Jump to search
(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...")
 
(No difference)

Latest revision as of 04:27, 10 January 2021

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