Created
October 3, 2018 07:17
-
-
Save shumon84/e6964a99d9d42b65d46b24e75a4ab4f4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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