Skip to content

Instantly share code, notes, and snippets.

@sirpengi
Created February 4, 2013 06:59
Show Gist options
  • Select an option

  • Save sirpengi/4705352 to your computer and use it in GitHub Desktop.

Select an option

Save sirpengi/4705352 to your computer and use it in GitHub Desktop.

Revisions

  1. sirpengi created this gist Feb 4, 2013.
    20 changes: 20 additions & 0 deletions blah.go
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    package main

    func modify (myarr *[]int) {
    myarr = append(*myarr, 4)
    }

    func main() {
    arr := []int{}
    arr = append(arr, 1)
    arr = append(arr, 2)
    arr = append(arr, 3)
    println(len(arr))
    modify(&arr)
    println(len(arr))
    s := 0
    for _, v := range arr {
    s = s + v
    }
    println("Result:", s)
    }