zoukankan      html  css  js  c++  java
  • Go的一些趣味题库

    一些Go基础题库,初学者可以学习一下

    package main
    
    import (
      "fmt"
    )
    
    func main() {
      a := make([]int, 20)
      a = []int{7, 8, 9, 10}
      b := a[15:16]
      fmt.Println(b)
    }
    

    输出:?

    package main
    
    import (
        "fmt"
        "sync"
    )
    
    func main() {
        var m sync.Map
        m.Store("address", map[string]string{"province": "江苏", "city": "南京"})
        v, _ := m.Load("address")
        fmt.Println(v["province"])
    }
    

    输出:?
    点击查看答案

    package main
    
    import (
        "fmt"
    )
    
    func hello(i *int) int {
        defer func() {
            *i = 19
        }()
        return *i
    }
    
    func main() {
        i := 10
        j := hello(&i)
        fmt.Println(i, j)
    }
    

    输出:?
    点击查看答案

    自知者不怨人,知命者不怨天。
  • 相关阅读:
    Google glass GDK
    Google glass GDK
    Google glass GDK
    趣味开发
    Android
    Google glass GDK
    Google glass GDK
    Google glass GDK
    Android
    Google glass GDK
  • 原文地址:https://www.cnblogs.com/liqingbo/p/14875070.html
Copyright © 2011-2022 走看看