title: How can I return different address of structs?
body: <p>I have a array of structs in the main function and I would like to save data of few structs. I'm using a function that receive the wanted data and put it into struct that is defined into the function.
  At the end of the process I return the address of this struct.
  But if I call to this function few times ,it always defines the same address of the struct so I am losing a data of the previous call.</p>
  <pre><code>#include&lt;stdio.h&gt;
  
  struct data {
      int day;
  };
  
  struct data* Dates(int val);
  
  int main() {
      struct data* Dates1[3];
      int array[] = { 12, 15, 2021 };
  
      for (int i = 0; i &lt; 3; i++) {
          Dates1[i] = Dates(array[i]);   
      }
  }
  
  struct data* Dates(int val)  {
      struct data Date;
      Date.day = val;
      return &amp;Date; ///AFTER EVERY CALL TO THIS FUNCTION IT RETURN THE SAME ADDRESS!!!
  }
  </code></pre>