A past puzzle — fully playable. 4 attempts, hints on wrong guesses.
stdle-55.go
1packagemain
2
3import"fmt"
4
5typeTstruct{Nint}
6
7funcmain(){
8a:=[2]T{{1},{2}}
9b:=a
10b[0].N=99
11fmt.Println(a[0].N,b[0].N)
12}
Classes
Answer & explanation
Console output
1 99
Why
Arrays (unlike slices) are value types in Go, so b := a copies every element into a new array. The structs inside are copied too. Writing b[0].N = 99 affects only b, leaving a[0].N at 1. A slice would have shared the backing store and behaved differently.