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

Consider the function below. Will the returned pointer cause `v` to escape to the heap, and what is the precise reasoning the compiler's escape analysis uses?

func newInt() *int { v := 42 return &v }