Created
July 3, 2018 09:20
-
-
Save akovardin/aa6772b7271c9efeddea07258c5ec3d0 to your computer and use it in GitHub Desktop.
Map modification
This file contains hidden or 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 call() { | |
| mm := m() | |
| fmt.Println(mm) | |
| mf(mm) | |
| fmt.Println(mm) | |
| } | |
| func mf(mm map[int]*int) { | |
| b := 2 | |
| mm[1] = &b | |
| } | |
| func m() map[int]*int { | |
| a := 1 | |
| mm := map[int]*int{1: &a} | |
| return mm | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment