title: Combining two structures into new one on C?
body: <p>So, we have an interesting situation.
  We are supposed to write a DBMS in C under Linux and we have the following problem:
  when trying to join two relations/tables the new relation/table has number of Fields/Columns equal to the sum of both joining relations/tables. This is fine, but when we have to copy the data of the tuple/row from the two joining relations/tables we don't seem to find a way. The tuples/rows are realized as list elements via this structure:</p>
  
  <pre><code>typedef struct element {
      void *data;
      struct element *next;
  } Element;
  </code></pre>
  
  <p>The new element is created via this function:</p>
  
  <pre><code>Element *
  newElement (void *data)
  {
      Element *e = (Element*) malloc (sizeof (Element));
      assert (e != NULL);
      e-&gt;data = data;
      e-&gt;next = NULL;
  
      return e;
  }
  </code></pre>
  
  <p>And the *data parameter is passed as of this type:</p>
  
  <pre><code>typedef struct {
      int sid;
      char sname[STRLEN];
      int rating;
      float age;
  } Sailor;
  </code></pre>
  
  <p>The thing is when we have to join two relations we cannot know what Structure they use for their tuples/rows and therefore we cannot create the new tuples/rows for the new relation from the tuples/rows of the two joining relations.</p>
  
  <p>Please help.</p>