fork download
  1. package main
  2.  
  3. import (
  4. "fmt"
  5. )
  6.  
  7. func main() {
  8. var numbers []*int
  9.  
  10. for _, value := range []int{10, 20, 30, 40} {
  11. numbers = append(numbers, &value)
  12. }
  13.  
  14. for _, number := range numbers {
  15. fmt.Printf("%d\n", *number)
  16. }
  17. }
  18.  
Success #stdin #stdout 0.01s 5292KB
stdin
Standard input is empty
stdout
40
40
40
40