lean into examples
This commit is contained in:
14
examples/pointers/pointers.go
Normal file
14
examples/pointers/pointers.go
Normal file
@@ -0,0 +1,14 @@
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func zero(xPtr *int) {
|
||||
*xPtr = 0
|
||||
}
|
||||
|
||||
func main() {
|
||||
x := 5
|
||||
fmt.Println(x)
|
||||
zero(&x)
|
||||
fmt.Println(x)
|
||||
}
|
||||
Reference in New Issue
Block a user