账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    Go questions
    37
    0

    如果你有更好的答案,请贴出来

    希望你也能把平时遇到的问题反馈在下面,我会归档到这里来,以此进步

    感兴趣的小伙伴点“关注”哦

    • 为什么不可以对字典map的元素取地址?
        eg:  m := map[string]int{"a":1,"b":2}
             fmt.Printf("%p",&m["a"]) //这里为什么不能对map元素取地址?
    • 下面这几组方法调用中传递的指针还是值拷贝,返回的是值拷贝还是指针?
        slice
        func q1(){
            s := []string{"1","2"}
            fmt.Printf("%p",s)
            q3 := q2(s)
            fmt.Printf("%p",q3)
        }
        func q2(s1 []string)[]string{
            fmt.Printf("%p",s1)
            return s1
        }
        
        array
        func q1(){
            a := [...]string{"1","2"}
            fmt.Printf("%p",a)
            q3 := q2(a)
            fmt.Printf("%p",q3)
        }
        func q2(a [2]string)[2]string{
            fmt.Printf("%p",a)
            return a
        }
        
        
    • 能不能解释一下slice,map不可以使用 == 操作,而array却可以?

    整理不易,如果这个问题对你用,请点击 左上方 向上箭头,谢谢! o(╥﹏╥)o

    期待答案

    • 给出自己的答案,思路,参考内容
    • 自己的使用经验
    • 给出自己认为有价值的问题

    Dangerous

    • 向 nil map中设置值会导致错误,设置之前必须初始化.

      var m map[string]int
      m["a"] = 3 //panic: assignment to entry in nil map
      
    • 向 nil map中设置值会导致错误

      var m map[string]int
      m["a"] = 3 //panic: assignment to entry in nil map
      

    reference:

    暂无

    0
    打赏
    收藏
    点击回答
    您的回答被采纳后将获得:提问者悬赏的 11 元积分
        全部回答
    • 0
    • 焉梦终成 普通会员 1楼
      1. What is the capital of Japan?
      2. Who is the CEO of Tesla?
      3. Who is the host of the 2022 Winter Olympics?
      4. What is the tallest mammal in the world?
      5. Who is the first African American to win an Olympic gold medal?
      6. What is the chemical symbol for gold?
      7. Who is the current leader of the United States?
      8. What is the currency of the United Kingdom?
      9. Who is the author of the novel "To Kill a Mockingbird"?
      10. What is the meaning of life?
    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部