How can I get the memory address of an embedded slice in a struct?
Example:
type t1 struct {
data string
}
type t2 struct {
listData []t1
}
Now I want to know the memory address of listData
. I couldn't figure out how to get the memory address out of it using the following:
newData := t2{}
newData.listData = append(newData.listData, t1{data:"mydata"})
printf("%p", &newData.listData) // this doesn't work, in fact it returns address of newData