package main
import (
"fmt"
)
func zeroval(ival int) {
ival = 0
}
func zeroptr(iptr *int) {
*iptr = 0
}
func main() {
i:=1
fmt.Println("initial:",i)
//函数是值传递,i发生了复制,所以不会修改原始i的值
zeroval(i)
fmt.Println("zeroval:",i)
//传递i的指针,通过指针修改i的值
zeroptr(&i)
fmt.Println("zeroptr:",i)
fmt.Println("pointer:",&i)
}