DEV Community

Nitin Bansal
Nitin Bansal

Posted on • Updated on

Let's confuse you all between arrays and slices in golang😎

#go

Let's see if you can correctly figure out the types of these (array or slice)

  1. a := [4]int{}
  2. a := []int{}
  3. a := []int{1,2,3}
  4. a := [4]int{}
  5. a := make([]int, 10)
  6. a := new([]int)
  7. a := *new([]int)
  8. a := *new([5]int)
  9. a := new([5]int)[:]

Top comments (0)