Skip to content

Instantly share code, notes, and snippets.

@shumon84
Created October 3, 2018 07:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shumon84/e6964a99d9d42b65d46b24e75a4ab4f4 to your computer and use it in GitHub Desktop.
Save shumon84/e6964a99d9d42b65d46b24e75a4ab4f4 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
)
func main() {
arr := [10]int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
parr1 := [10]*int{}
parr2 := [10]*int{}
for i := 0; i < len(arr); i++ {
parr1[i] = &arr[i]
}
for i, v := range arr {
parr2[i] = &v
}
for i := 0; i < len(arr); i++ {
fmt.Println(arr[i], *parr1[i], *parr2[i])
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment