I was surprised to be able to initialize a fragment of pointers in this way:
package main
import (
"fmt"
)
type index struct {
i, j int
}
func main() {
indices := []*index{{0, 1}, {1, 3}}
fmt.Println(*indices[1])
}
I expected that I should write something more detailed, for example:
indices := []*index{&index{0, 1}, &index{1, 3}}
Where can I find this in the documentation?
source
share