Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import "fmt"
- func main () {
- x := 10
- callByValue(x)
- fmt.Println(x) //=> 10
- callByPointer(&x)
- fmt.Println(x) //=> 11
- }
- func callByValue(a int) {
- a++
- }
- func callByPointer(a *int) {
- *a++
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement