搜了一圈也没看到我想要的,下面附上代码:
package main
import (
"fmt"
)
func main() {
n := 2
m := 3
//动态创建二维数组
grid := make([][]int, n)
for i := 0; i < n; i++ {
grid[i] = make([]int, m)
}
/*
000
000
*/
for i := 0; i < n; i++ {
for j := 0; j < m; j++ {
fmt.Print(grid[i][j])
}
fmt.Println()
}
}