Standard library / reflect
reflect.PointerTo()
Construct the pointer type whose element is t. It does not allocate an object. Expected stdout: '*int\n'.
Formal Syntax & Structure
go syntaxgo
func PointerTo(t Type) TypeParameters & Attributes
| Name | Type | Description |
|---|---|---|
| t | Type | Element type of the new composite type. |
Return Value
Type
Construct the pointer type whose element is t.
Working Example
Example Snippetgo
package main
import ( "fmt" "reflect")
func main() { fmt.Println(reflect.PointerTo(reflect.TypeOf(0))) }