Sign in
go
/
talks
/
2f810f24ab988b98107bc78d8a71647ce9fbf085
/
.
/
2015
/
go-for-java-programmers
/
safe.go
blob: 4186f42fcc66fbe30906031b9b0e6f79884a747d [
file
] [
log
] [
blame
]
package main
import "fmt"
func newInt(v int) *int {
var n = v
return &n
// HL
}
func inc(p *int) {
*p++
// try removing * // HL
}
func main() {
p := newInt(3)
inc(p)
fmt.Println(p, "points to", *p)
}