title: What role does type casting play in dynamic memory allocation?
body: <p>As far as I know, dynamic memory allocation can be done in C by using the <code>malloc</code> function :</p>
  
  <pre><code>     int *p = (int *)malloc(sizeof(int))
  </code></pre>
  
  <p>My question is :</p>
  
  <ol>
  <li><p>How does dynamic memory allocation work, and how is it different from the normal method i.e. static allocation in terms of working ?</p></li>
  <li><p>What is the role of the statement <code>(int *)</code> before the <code>malloc()</code> function ?</p></li>
  <li><p>What role does type casting play here? (if it does that is )</p></li>
  </ol>