Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardGoslice header aliasing pitfallsSingle-choice MCQ

Given the slice operations below, what does `len(b)` and the value of `c[0]` end up being, and why?

a := make([]int, 3, 5) // len 3, cap 5 b := a[1:2] // len 1, cap 4 b = append(b, 99) // fits in cap, no realloc c := a[2:3] fmt.Println(len(b), c[0])