Go slices - capacity/length?
<p>Trying to learn Go from the tutorial right now, and have a pretty basic question:</p>

<pre><code> func main() {
  a := make([]int, 5)
  // [0,0,0,0,0] len=5 cap=5

  b := make([]int, 0, 5)
  // [] len=0 cap=5

  c := b[:2]
  // [0,0] len=2 cap=5

  d := c[2:5]
  // [0,0,0] len=3 cap=3
}
</code></pre>

<p>Why does <code>c</code> look like <code>[0,0]</code> and have length 2? <code>b</code> was not originally zero'ed hence it being <code>[]</code>. So does setting <code>c</code> to <code>b[:2]</code> zero out the first two elements?</p>

<p>Also, why is the capacity of <code>d</code> 3? Very confused.</p>

<p>Thanks in advance.</p>