Advertisement
Guest User

Untitled

a guest
Apr 6th, 2020
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.21 KB | None | 0 0
  1. func p(s []int) {
  2.     fmt.Println(s, len(s), cap(s))
  3. }
  4.  
  5. func main() {  
  6.     f := make([]int, 2, 4)
  7.     h := f[:]
  8.    
  9.     f = append(f, 11)
  10.     h = append(h, 22)
  11.     f = append(f, 33)
  12.     f = append(f, 44)
  13.    
  14.    
  15.     p(f)
  16.     p(h)
  17.        
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement