import "fmt"
func zeroptr(ptr *int) {
*ptr = 0
}
func main() {
oneptr * int
*ptr = 1
fmt.Println("ptr is :", *ptr)
zeroptr(ptr)
fmt.Println("after calling zeroptr, the value of ptr is :", *ptr)
}
This does not work, I am looking for output as follows:
ptr is :1
after calling zeroptr, the value of ptr is : 0