1

*[]与stract

 2 years ago
source link: https://studygolang.com/articles/35207
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

*[]与stract

aaaaaa · 3天之前 · 233 次点击 · 预计阅读时间不到 1 分钟 · 大约8小时之前 开始浏览    
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))
}



有疑问加站长微信联系(非本文作者)

280

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK