Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardGoescape analysisSingle-choice MCQ

A common surprise: passing a value to fmt.Println can force it to escape. Given the snippet, why does the compiler report that n escapes to the heap even though it is a local int?

func f() { n := 42 fmt.Println(n) }