Pointers are useful to pass around shared state. Values are usually copied
so changes on one copy are not visible on the other. Pointers on the other
hand are an address to some value (and the address is also copied by
passing it around) but the value these addresses point to is exactly one
same value so changes done via one pointer are visible via the other one.

I see it like this: „here’s your meal” is a value, “your meal is in the
fridge” is a pointer to a value and “your meal is in the cookbook” is a
pointer to a pointer to a value :-)

伊藤和也 <kazya.ito.dr...@gmail.com> schrieb am Di. 1. Jan. 2019 um 12:34:

> What are the reasonable reasons to use pointers? Are pointers neseccary?
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to