I need to get the string value of pointer, how can I achieve it?
Something like &a.String()
I need to get the string value of pointer, how can I achieve it?
Something like &a.String()
Use fmt.Sprintf()
:
func main() {
i := 42
ip := &i
strValue := fmt.Sprintf("%p", &ip)
fmt.Println(strValue)
}