title: Scope of malloc used in a function
body: <p>When a function returns, is the memory allocated via malloc freed? Or can it still be accessed in the main() function using pointers?</p>
  
  <p>eg.</p>
  
  <pre><code>void function(int *a)
  {
      a=(int *)malloc(sizeof(int));
      *a=10;
  }
  int main()
  {
      int *num;
      function(num);
      printf("%d",*num);
      return(0);
  }
  </code></pre>
  
  <p>Can the integer stored in a be accessed by main() here?</p>