← Back to archive

Stdle #116 · iteration · 2026-09-30

What does this Go snippet output?

A past puzzle — fully playable. 4 attempts, hints on wrong guesses.

package main
import "fmt"
func main() {
ptrs := []*int{}
for i := 0; i < 3; i++ {
ptrs = append(ptrs, &i)
}
for _, p := range ptrs {
fmt.Print(*p)
}
fmt.Println()
}
Iteration
4 attempts left

Answer & explanation