I am trying to use slice of type struct. Look at the following sample
package main
import (
"fmt"
)
func main() {
arr := []struct {
A string
B string
} {}
arr[0].A = "I am"
arr[0].B = "First"
arr[1].A = "I am"
arr[1].B = "Second"
fmt.Println(arr)
}
When I compile this code I've got out of range error. Why?