q Why do we need pointers?
Go has pointers. Pointer holds the memory address of a value.
The type *T
is a pointer to a T
value. Its zero value is nil
.
The &
operator generates a pointer to its operand.
The *
operator denotes the pointerβs underlying value.
This is known as dereferencing.
Go has no pointer arithmetic, unlike C.