go基础指针
go 基础指针
//go 语音指针
name := "lili"
ptr := &name
fmt.Println(*ptr)
fmt.Println(ptr)
//2 new关键字定义
name2prt := new(string)
*name2prt = "lily"
fmt.Println(name2prt)
fmt.Println(*name2prt)
//空指针,go nil
if &name == nil{
fmt.Println("name is nil")
} else {
fmt.Println("name is not nil")
}