title: Pointer to slice and array
body: <p>I was looking at Go's heap package's (<a href="https://golang.org/pkg/container/heap/" rel="nofollow noreferrer">https://golang.org/pkg/container/heap/</a>) Priority Queue example and came across this: </p>
  
  <pre><code>type PriorityQueue []*Item
  ...
  func (pq *PriorityQueue) Pop() interface{} {
      old := *pq
      n := len(old)
      item := old[n-1]
      item.index = -1 // for safety
      *pq = old[0 : n-1]
      return item
  } 
  </code></pre>
  
  <p>When I started playing around with this code to make sure I understood it, I tried:</p>
  
  <pre><code>item := *pq[0] // error
  </code></pre>
  
  <p>This gives you type *[]T does not support indexing. But if you do:</p>
  
  <pre><code>item := (*pq)[0] // all is well
  </code></pre>
  
  <p>This is type assertion right? Was hoping someone could explain what is going on here. </p>
  
  <p>Here is some code to quickly show this: <a href="https://play.golang.org/p/uAzYASrm_Q" rel="nofollow noreferrer">https://play.golang.org/p/uAzYASrm_Q</a></p>