title: Return Structure from Function (C)
body: <p>I need to create a structure inside a function (dynamically with malloc)
  Then i need to  be able to  send it to my main, and use it there. 
  I have no problems creating it, I simply need help sending it to my main, and I'm also unsure of how to access it once I get it there.</p>
  
  <pre><code>struct retValue * fn() {
  struct retValue
  {
      int number;
  };
  
  struct retValue* st = malloc(sizeof(*st));
  
  
  return(???);   
  }
  </code></pre>
  
  <p>That is the code i have so far.</p>
  
  <p>Thanks for any help. Let me know if you need something clarified.</p>
  
  <p>EDIT:</p>
  
  <p>Ok Some clarification is needed. </p>
  
  <p>What I am trying to achieve, is the ability to pass a structure through  a function to my main. Inside the function i must declare variables, and assign them values. Then in the main I must print each variable of the structure to the screen. No global variables can be used (and thus i assume no global structures).</p>
  
  <p>Hopefully that clarifies things.</p>
  
  <p>EDIT 2:</p>
  
  <p>I've figured out my problem. For those interested, I needed to have the structure prototype outside of my functions first. Then i could pass st and then access it properly.
  Thanks to all, and sorry for the poor wording. </p>