Why, when I print a derefrenced pointer in main that points to a variable declared in a function, does it not print junk memory. (GOLANG) : package main
  2 
  3 import "fmt"
  4 
  5 
  6 func point(x int) *int {
  7 
  8         y := x
  9         return &y
 10 
 11 }
 12 
 13 
 14 func main() {
 15 
 16         x := 10
 17 
 18         pointer := point(x)
 19 
 20         fmt.Println(*pointer)
 21 
 22 
 23 
 24
 25 }

Shouldn't the memory for Y be junk after the function has been called?
It prints 10 just fine.
~                         