Standard library / go/types

go/types.Pointer.Elem()

Pointed-to type. Expected stdout: 'int\n'.

Formal Syntax & Structure

go syntaxgo
func (p *Pointer) Elem() Type

Return Value

Type

Pointed-to type.

Working Example

Example Snippetgo
package main
import (  "fmt"  "go/types")
func main() { t := types.NewPointer(types.Typ[types.Int]); fmt.Println(t.Elem()) }
Go Reference