Standard library / go/types

go/types.NewPointer()

Constructs a pointer type descriptor. This does not allocate a runtime value. Expected stdout: '*int\n'.

Formal Syntax & Structure

go syntaxgo
func NewPointer(elem Type) *Pointer

Parameters & Attributes

NameTypeDescription
elemTypeElement type.

Return Value

*Pointer

Constructs a pointer type descriptor.

Working Example

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