Standard library / reflect
reflect.Value.Addr()
Return a reflected pointer to an addressable value; check CanAddr first. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
func (v Value) Addr() ValueReturn Value
Value
Return a reflected pointer to an addressable value; check CanAddr first.
Working Example
Example Snippetgo
package main
import ( "fmt" "reflect")
func main() { n := 4; v := reflect.ValueOf(&n).Elem(); fmt.Println(v.Addr().Interface().(*int) == &n) }