title: Can I free() static and automatic variables in C?
body: <p>The code is as follow :</p>
  
  <pre><code>#include &lt;stdlib.h&gt;
  
  int num = 3;   // Static external variable
  int *ptr = &amp;num;
  
  int main(void)
  {
   int num2 = 4;  // Automatic variable
   int *ptr2 = &amp;num2;
  
   free(ptr);  //Free static variable
   free(ptr2); //Free automatic variable
  
   return 0; 
  }
  </code></pre>
  
  <p>I try to compile the above code and it works, I'm curious does the <code>free()</code> function able to free both the static variable and also automatic variable? Or basically it does nothing?</p>