作者:mobiledu2502938445 | 来源:互联网 | 2023-08-16 03:55
funcmain(){a:models.SmsVerify{}a.Id100fmt.Println(a.Id)100test111(a)fmt.Println(a.Id)100a2
func main() {
a := models.SmsVerify{}
a.Id = 100
fmt.Println(a.Id) // 100
test111(a)
fmt.Println(a.Id) // 100
a222 := new(models.SmsVerify)
a222.Id = 200
fmt.Println(a222.Id) // 200
test222(a222)
fmt.Println(a222.Id) // 201
}
func test111(sms models.SmsVerify) {
sms.Id++
}
func test222(sms *models.SmsVerify) {
sms.Id++
}