title: How to return an integer from a function
body: <p>Which is considered better style?</p>
  
  <pre><code>int set_int (int *source) {
     *source = 5;
     return 0;
  }
  
  int main(){
     int x;
     set_int (&amp;x);
  }
  </code></pre>
  
  <p>OR</p>
  
  <pre><code>int *set_int (void) {
      int *temp = NULL;
      temp = malloc(sizeof (int));
      *temp = 5;
      return temp;
  }
  
  int main (void) {
      int *x = set_int ();
  }
  </code></pre>
  
  <p>Coming for a higher level programming background I gotta say I like the second version more.  Any, tips would be very helpful. Still learning C.</p>