type per struct {
name string
age uint8
}
type pers []*per
func main() {
// 看
p1:=per{
name: "lili",
age: 20,
}
a := pers{
&p1,
&per{
name: "lili",
age: 20,
},
&per{
name: "lili",
age: 20,
},
}
for index,values := range a{
fmt.Println(index,*values)
}
fmt.Println(reflect.TypeOf(a))
}
有疑问加站长微信联系(非本文作者)