title: Memory allocation and NULL pointer
body: <p>I am confused from something.</p>
  
  <p>first:</p>
  
  <pre><code>int *ptr;
  ptr = malloc(10 * sizeof(int));
  </code></pre>
  
  <p>This type of getting dynamic(heap) memory at <strong>run-time</strong>, not <strong>compile time</strong> like arrays.</p>
  
  <p><code>malloc()</code> may be return <code>NULL</code> if there is no memory.</p>
  
  <p>And <code>NULL</code> is a <code>#define</code> in Standard C Library <code>#define NULL ((void *)0)</code></p>
  
  <p>So, if the <code>malloc</code> return <code>NULL</code> and it executes at <strong>run-time</strong>, how the compiler will substitute <code>NULL</code> with <code>void *0</code> and I know that any text substitution happen in <strong>pre-compile phase</strong></p>