title: C struct to void* pointer
body: <p>I have a struct defined as:</p>
  
  <pre><code>typedef struct {
     int type;
     void* info;
  } Data;
  </code></pre>
  
  <p>and then i have several other structs that i want to assign to the void* using the following function:</p>
  
  <pre><code>Data* insert_data(int t, void* s)
  {
      Data * d = (Data*)malloc(sizeof(Data));
      d-&gt;type = t;
      d-&gt;info = s;
  
      return d;
  }
  
  struct {
     ...
  } Struct#;
  </code></pre>
  
  <p>then i just call </p>
  
  <pre><code>insert_data(1, variable_of_type_Struct#);
  </code></pre>
  
  <p>When i compile this it gives a warning</p>
  
  <pre><code>warning: assignment from incompatible pointer type
  </code></pre>
  
  <p>i tried to cast the variable in the insert to (void*) but didn't work</p>
  
  <pre><code>insert_data(1, (void *) variable_of_type_Struct#);
  </code></pre>
  
  <p>How can i get rid of this warning?</p>
  
  <p>Thanks</p>