Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumGogenerics type parametersSingle-choice MCQ

This generic function tries to create a zero value of its type parameter and return a pointer to it. Does it compile, and what does it return for Zero[int]()?

func Zero[T any]() *T { var z T return &z } func main() { p := Zero[int]() println(*p) }