#golang #pop #quiz
func main() {
var val int
println(&val)
f(10000)
println(&val)
}
func f(i int) {
if i--; i == 0 {
return
}
f(i)
}
this program prints:
[playground (spoilers) https://play.golang.org/p/JQSqP3yV3Et ]
-
-
You are correct
You have to use the builtin println or otherwise the variable escapes to the heap. - Još 4 druga odgovora
Novi razgovor -
-
-
Nice one! Shameless plug: Another post on the transition from segmented to contiguous stacks: https://agis.io/post/contiguous-stacks-golang/ …
Hvala. Twitter će to iskoristiti za poboljšanje vaše vremenske crte. PoništiPoništi
-
Čini se da učitavanje traje već neko vrijeme.
Twitter je možda preopterećen ili ima kratkotrajnih poteškoća u radu. Pokušajte ponovno ili potražite dodatne informacije u odjeljku Status Twittera.
