Golang 指向字典指针

优质
小牛编辑
148浏览
2023-12-01

与普通指针并无差异

package main
import "fmt"
func main() {
	var dict map[string]string = map[string]string{"name":"lnj", "age":"33"}
	var p *map[string]string = &dict
	(*p)["name"] = "zs"
	fmt.Println(dict)
}