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)
}
Anyone can tell me the correct way to square it? The problem is invalid direct of square(type[4]int)
**supposed to do? – fuz Nov 24 '14 at 15:25**isn't an operator, so you havebox * (*box), butboxisn't a pointer so you can't de-reference it. (it still wouldn't make sense if it was a pointer either) – JimB Nov 24 '14 at 18:54