Pointers in Golang
What’s a pointer ?
In Go , A pointer is a variable whose value is a memory address.
A pointer is defined using the ampersand operator.
Following a Pointer
In order to access ie following the pointer value , Go uses the asterisk operator.
Why is it needed ?
Pointers are very useful in Go because they allow the programmer to choose between passing a value and passing a reference
- A pointer is a variable whose value is a memory address
- Pointers are defined using ampersand , address operator
- Pointers are followed using asterisk operator
- You can point at pointers
- Go does not support pointer arithmetic to prevent memory address manipulation
- Pointers are useful when choosing passing by value or by reference