Go语言 之结构体数组

package main

import (
    "fmt"
)

type Student struct {
    id    int
    name  string
    score float64
}

func main() {
    s := []Student{
        Student{
            1,
            "yy",
            82,
        },
        Student{
            2,
            "yang",
            67,
        },
        Student{
            3,
            "go",
            91,
        },
    }
    fmt.Println(s)
}

 

posted @ 2019-07-02 10:23  样子2018  阅读(10757)  评论(0编辑  收藏  举报