技术宅,fat-man

增加语言的了解程度可以避免写出愚蠢的代码

导航

go:数组

package main

import "fmt"
import "unsafe"

type Employee struct{name string; age int} 

func displayName(e *Employee){
    fmt.Printf("employee name is %s ,age is %d\n",(*e).name,(*e).age)
}

func main() {
    var e = [2]Employee{{"shujun.li",30},{"qiuming.tan",30}}
    displayName(&e[0])
    displayName(&e[1])
}

 

posted on 2013-05-14 12:26  codestyle  阅读(167)  评论(0)    收藏  举报