Skip to content

Instantly share code, notes, and snippets.

@hackintoshrao
Created January 31, 2016 05:02
Show Gist options
  • Save hackintoshrao/69898cd223363f9985c6 to your computer and use it in GitHub Desktop.
Save hackintoshrao/69898cd223363f9985c6 to your computer and use it in GitHub Desktop.
demosntration of slice holding reference to the underlaying array
package main
import "fmt"
func main() {
array := [4]int{1,2,3,4}
sliceFromArray := array[:3]
fmt.Printf("array = %v , slice = %v\n",array,sliceFromArray)
sliceFromArray[2] = 4
fmt.Printf("array = %v , slice = %v\n",array,sliceFromArray)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment