go 语言与循环

时间:2023-03-09 16:38:27
go 语言与循环
package main

import "fmt"

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 = []Employee{{"shujun.li",30},{"qiuming.tan",30}}
for i :=0 ; i < 2; i++ {
displayName(&e[i])
}
}