title: Dynamically initialize array size in go
body: <p>I try to write a small application in go that takes 'x' numbers of integers from standard input, calculates the mean and gives it back. I have only gotten so far:</p>
  
  <pre><code>func main() {
  var elems, mean int
  sum := 0
  
  fmt.Print("Number of elements? ")
  
  fmt.Scan(&amp;elems)
  
  var array = new([elems]int)
  
  for i := 0; i &lt; elems; i++ {
      fmt.Printf("%d . Number? ", i+1)
      fmt.Scan(&amp;array[i])
      sum += array[i];
  }............
  </code></pre>
  
  <p>When trying to compile this I get the following error message:</p>
  
  <blockquote>
    <p>invalid array bound elems</p>
  </blockquote>
  
  <p>What is wrong here?</p>