```golang
package main
import "fmt"
func double(x *int) {
*x += *x
x = nil
}
func main() {
var a = 3
double(&a)
fmt.Println(a, &a == nil) // 6 false
fmt.Println("======================")
p := &a
double(p)
fmt.Println(a, p == nil) //12 false
}
```
更多评论