2 ms·
This is correct. A pointer like `p := &x[0]` will always point at the original backing array even if an append on the slice causes the slice to allocate a new b
by throwaway894345 5y ago
This is correct. A pointer like `p := &x[0]` will always point at the original backing array even if an append on the slice causes the slice to allocate a new backing array. This means that you can update `x[0]` on the new slice without changing `*p`.
https://play.golang.org/p/Hl58VW-Yvhn https://play.golang.org/p/Hl58VW-Yvhn