Skip to content

Instantly share code, notes, and snippets.

@emre
Created August 22, 2013 11:02
Show Gist options
  • Select an option

  • Save emre/6305854 to your computer and use it in GitHub Desktop.

Select an option

Save emre/6305854 to your computer and use it in GitHub Desktop.
golang pointers
package main
import "fmt"
func swap(x *int, y *int) {
*x, *y = *y, *x
}
func main() {
x := 5
y := 10
swap(&x, &y)
fmt.Println(x, y)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment