10.3 使用自定义包中的结构体
...小于 1 分钟
10.3 使用自定义包中的结构体
package structPack
type ExpStruct struct {
Mi1 int
Mf1 float32
}
package main
import (
"fmt"
"./struct_pack/structPack"
)
func main() {
struct1 := new(structPack.ExpStruct)
struct1.Mi1 = 10
struct1.Mf1 = 16.
fmt.Printf("Mi1 = %d\n", struct1.Mi1)
fmt.Printf("Mf1 = %f\n", struct1.Mf1)
}
Powered by Waline v2.15.2