package main
import "fmt"
/*
D:\examples>go run helloworld.go
10
100
5
100
D:\examples>
*/
func main() {
i := 10
pass_by_value(i)
fmt.Println(i)
pass_by_reference(&i)
fmt.Println(i)
x := new(int)
*x = 5
fmt.Println(*x)
pass_by_reference(x)
fmt.Println(*x)
}
func pass_by_value(i int) {
i = 100
}
func pass_by_reference(i *int) {
*i = 100
}