Type semantics
Addressability
Variables, pointer dereferences, slice elements and fields of addressable structs can be addressed. Map elements cannot. Taking the address of a composite literal is an explicit exception. Example output: '7'.
Formal Syntax & Structure
go syntaxgo
&variable; &T{...}Working Example
Example Snippetgo
package main
import "fmt"
func main() { s := []int{2} p := &s[0] *p = 7 fmt.Println(s[0])}