How to Declare and Use Pointers in Go

Declare Go pointers with `*`, get addresses with `&`, and dereference values with `*` to modify variables directly.

Declare a pointer variable using the * symbol before the type, assign it the address of a variable using &, and access the value it points to using *.

package main

import "fmt"

func main() {
  x := 42
  var ptr *int = &x
  fmt.Println(*ptr) // 42
  *ptr = 100
  fmt.Println(x)    // 100
}