map.md 322 字节
Newer Older
麻凡_'s avatar
麻凡_ 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
# map的初始化
下面代码运行是否会报错?

```Go
func main() {
    var employeeSalary map[string]int
    employeeSalary["steve"] = 12000
    fmt.Println(employeeSalary)
}
```

## 答案

`assignment to entry in nil map`

## 选项

### A

输出 `nil`

### B

输出 `map[steve:12000]`

### C

输出 1200