小编Ant*_*FSS的帖子

如何平方数组中的所有数字?Golang

package main

import (
    "fmt"
)

func main() {
    var square int
    box := [4]int{1, -2, 3, 4}

    square = box * *box

    fmt.Println("The square of the first box is", square)
}
Run Code Online (Sandbox Code Playgroud)

任何人都可以告诉我正确的方法吗?问题是square的直接无效(type [4] int)

go

-3
推荐指数
1
解决办法
4250
查看次数

标签 统计

go ×1