title: How do I allocate an array at runtime in Rust?
body: <p>Once I have allocated the array, how do I manually free it? Is pointer arithmetic possible in unsafe mode? </p>
  
  <p>Like in C++:</p>
  
  <pre class="lang-cpp prettyprint-override"><code>double *A=new double[1000];
  double *p=A;
  int i;
  for(i=0; i&lt;1000; i++)
  {
       *p=(double)i;
        p++;
  }
  delete[] A;
  </code></pre>
  
  <p>Is there any equivalent code in Rust?</p>