Below code:
// You can edit this code!
// Click here and start typing.
package main
import "fmt"
type A []*B
type B struct {
I int
}
func main() {
x := A{
&B{1}, &B{2},
}
fmt.Println(x.I)
}
gives error: x.I undefined (type A has no field or method I)
-
Is the composite literal syntax correct? to initialize value of type
A
-
How to access field
I
from variablex
?