返回顶部

收藏

Go语言中的指针

更多

涉及到Go语言中“new”、“*”和“&”的用法。

[Google Go]代码

package main

import "fmt"

type S map[string][]string

func Summary(param string) (s *S) {
  s = &S{
    "name": []string{param},
    "profession": []string{"Java programmer", "Project Manager"},
    "interest(lang)": []string{"Clojure", "Python", "Go"},
    "focus(project)": []string{"UE", "Agile Methodology", "Software Engineering"},
    "hobby(life)": []string{"Basketball", "Movies", "Travel"},
  }
  return s
}

func main() {
  s := Summary("Harry")
  fmt.Printf("Summary(address): %v\n", s)
  fmt.Printf("Summary(content): %v\n", *s)
}

标签:Google,Go,for,IntelliJ,Idea

收藏

0人收藏

支持

0

反对

0

发表评论