title: Why must malloc be used?
body: <p>From what I understand, the malloc function takes a variable and allocates memory as asked. In this case, it will ask the compiler to prepare memory in order to fit the equivalence of twenty double variables. Is my way of understanding it correctly, and why must it be used?</p>
  
  <pre><code>double *q;
  
  q=(double *)malloc(20*sizeof(double));
  
  for (i=0;i&lt;20; i++)
  {
      *(q+i)= (double) rand();
  }
  </code></pre>