Skip to content

Instantly share code, notes, and snippets.

@akawashiro
Created February 15, 2019 04:02
Show Gist options
  • Save akawashiro/74acb88773e3a8ada26e7bf4268208af to your computer and use it in GitHub Desktop.
Save akawashiro/74acb88773e3a8ada26e7bf4268208af to your computer and use it in GitHub Desktop.
package main
import "fmt"
func ping(msg chan string, p *int) {
msg <- "ping"
*p = 200
}
func main() {
msg := make(chan string)
var p *int
var n int = 100
p = &n
go ping(msg, p)
s := <-msg
fmt.Println(s)
fmt.Println("n = ", *p)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment