Created
February 15, 2019 04:02
-
-
Save akawashiro/74acb88773e3a8ada26e7bf4268208af to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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