Created
July 17, 2018 14:37
-
-
Save afucher/e8e95a4c9c8625c040ccae962782172b 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() { | |
tstSlice2() | |
} | |
func tstSlice2() { | |
var meuSlice = make([]int, 1, 2) | |
meuSlice[0] = 1 | |
printSlice(meuSlice, "meuSlice") | |
meuSlice[0] = 2 | |
printSlice(meuSlice, "meuSlice") | |
meuSlice[0] = 3 | |
printSlice(meuSlice, "meuSlice") | |
} | |
func printSlice(meuSlice []int, sliceName string) { | |
fmt.Printf("%v> %v - %v - %v - %p \n", sliceName, len(meuSlice), cap(meuSlice), meuSlice, &meuSlice) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment